search for: js_true

Displaying 20 results from an estimated 59 matches for "js_true".

2007 Mar 22
0
7 commits - configure.ac doc/swfdec-docs.sgml libswfdec/js libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_js_movie.c test/trace
...ec/swfdec_js_movie.c @@ -116,7 +116,11 @@ mc_play (JSContext *cx, JSObject *obj, u { SwfdecMovie *movie; - movie = JS_GetPrivate(cx, obj); + movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE); + if (movie == NULL) { + SWFDEC_WARNING ("not a movie"); + return JS_TRUE; + } g_assert (movie); movie->stopped = FALSE; @@ -128,8 +132,11 @@ mc_stop (JSContext *cx, JSObject *obj, u { SwfdecMovie *movie; - movie = JS_GetPrivate(cx, obj); - g_assert (movie); + movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE); + if (movie == NULL) {...
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
...return NULL; + } + return SWFDEC_MOVIE (object); +} + +#if 0 +static void +swfdec_action_push_string (SwfdecAsContext *cx, const char *s) +{ + JSString *string = JS_NewStringCopyZ (cx, s); + if (string == NULL) + return JS_FALSE; + *cx->fp->sp++ = STRING_TO_JSVAL (string); + return JS_TRUE; +} + +static void +swfdec_value_to_boolean_5 (SwfdecAsContext *cx, jsval val) +{ + if (JSVAL_IS_BOOLEAN (val)) { + return JSVAL_TO_BOOLEAN (val); + } else if (JSVAL_IS_INT (val)) { + return JSVAL_TO_INT (val) != 0; + } else if (JSVAL_IS_DOUBLE (val)) { + double d = *JSVAL_TO_DOUBLE (va...
2007 Jun 21
0
Branch 'as' - 5 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_connection.c libswfdec/swfdec_net_stream_as.c libswfdec/swfdec_net_stream.c
...ayer_internal.h" - -static JSBool -swfdec_js_net_stream_play (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - SwfdecNetStream *stream; - const char *url; - - stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); - if (stream == NULL) - return JS_TRUE; - url = swfdec_js_to_string (cx, argv[0]); - if (url == NULL) - return JS_FALSE; - swfdec_net_stream_set_url (stream, url); - swfdec_net_stream_set_playing (stream, TRUE); - return JS_TRUE; -} - -static JSBool -swfdec_js_net_stream_pause (JSContext *cx, JSObject *obj, uintN argc, jsval *ar...
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
...ate: Mon Jan 29 19:07:12 2007 +0100 implement InitObject action all tests pass now diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index b1f1a63..64f0746 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1105,6 +1105,35 @@ fail: return JS_TRUE; } +static JSBool +swfdec_action_init_object (JSContext *cx, guint action, const guint8 *data, guint len) +{ + JSStackFrame *fp = cx->fp; + JSObject *object; + guint i, n_args; + + if (!JS_ValueToECMAUint32 (cx, fp->sp[-1], &n_args)) + return JS_FALSE; + if ((guint) (fp->sp...
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
...- return js_obj_toSource(cx, obj, argc, argv, rval); -#endif - clasp = OBJ_GET_CLASS(cx, obj); - clazz = clasp->name; - /* special case in here (woohoo) */ if (clasp == &js_ArgumentsClass) { - *rval = STRING_TO_JSVAL(cx->runtime->emptyString); - return JS_TRUE; + *rval = STRING_TO_JSVAL(cx->runtime->emptyString); + return JS_TRUE; } - - nchars = 9 + strlen(clazz); /* 9 for "[object ]" */ - chars = (jschar *) JS_malloc(cx, (nchars + 1) * sizeof(jschar)); - if (!chars) - return JS_FALSE; - - prefix = "[o...
2007 Feb 01
0
Branch 'interpreter' - libswfdec/swfdec_script.c
...100 implement WaitForFrame2 videostar.swf works now diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 39b3b8b..c416f64 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -267,6 +267,27 @@ swfdec_action_goto_label (JSContext *cx, return JS_TRUE; } +static int +swfdec_value_to_frame (JSContext *cx, SwfdecMovie *movie, jsval val) +{ + int frame; + + if (JSVAL_IS_STRING (val)) { + const char *name = swfdec_js_to_string (cx, val); + if (name == NULL || + !SWFDEC_IS_SPRITE_MOVIE (movie)) + return -1; + if (strchr (nam...
2007 Jun 27
0
Branch 'as' - libswfdec/swfdec_as_strings.c libswfdec/swfdec_net_stream_as.c libswfdec/swfdec_net_stream.c
...ream, d); } -#if 0 -static void -swfdec_net_stream_time (SwfdecAsContext *cx, SwfdecAsObject *obj, SwfdecAsValue id, SwfdecAsValue *vp) -{ - SwfdecNetStream *stream; - guint msecs; - - stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); - if (stream == NULL) - return JS_TRUE; - - if (stream->flvdecoder == NULL || - !swfdec_flv_decoder_get_video_info (stream->flvdecoder, &msecs, NULL)) { - *vp = INT_TO_JSVAL (0); - return JS_TRUE; - } - if (msecs >= stream->current_time) - msecs = 0; - else - msecs = stream->current_time - msecs;...
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
...Jan 22 10:54:05 2007 +0100 implement Increment and Decrement diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 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_incremen...
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
...007 +0200 implement InitObject action diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c index 63b53a6..f5503fb 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -1192,35 +1192,31 @@ fail: fp->sp[-1] = JSVAL_VOID; return JS_TRUE; } +#endif static void swfdec_action_init_object (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { - JSStackFrame *fp = cx->fp; - JSObject *object; - guint n_args; - gulong i; + SwfdecAsStack *stack = cx->frame->stack; + SwfdecAsObject *object; + guint i, n_...
2007 Jan 18
0
Branch 'interpreter' - 2 commits - libswfdec/js libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...quot; static SwfdecMovie * swfdec_action_get_target (JSContext *cx) @@ -45,9 +47,91 @@ swfdec_action_stop (JSContext *cx, guint SwfdecMovie *movie = swfdec_action_get_target (cx); if (movie) movie->stopped = TRUE; + else + SWFDEC_ERROR ("no movie to stop"); return JS_TRUE; } +static JSBool +swfdec_action_play (JSContext *cx, guint action, const guint8 *data, guint len) +{ + SwfdecMovie *movie = swfdec_action_get_target (cx); + if (movie) + movie->stopped = FALSE; + else + SWFDEC_ERROR ("no movie to play"); + return JS_TRUE; +} + +static JSB...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...; } return OBJ_SET_PROPERTY (cx, obj, (jsid) atom, ret); } diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 83dde3a..d688693 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -701,30 +701,32 @@ swfdec_action_pop (JSContext *cx, guint return JS_TRUE; } -static const char *properties[22] = { - "_x", "_y", "_xscale", "_yscale", "_currentframe", - "_totalframes", "_alpha", "_visible", "_width", "_height", - "_rotation", "_targe...
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
...fdec_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 * JSStackFrame *fp = cx->fp; const char *s; guint32 n_args; - JSObject *obj; + JSObject *obj, *pobj; + JSProperty *prop; jsval fun; + JSAtom *atom; s = swfdec_js_to_string (cx, fp->sp[-1]); if (...
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
.../libswfdec/swfdec_js_color.c index ade8d6a..095abd7 100644 --- a/libswfdec/swfdec_js_color.c +++ b/libswfdec/swfdec_js_color.c @@ -32,7 +32,8 @@ swfdec_js_color_get_rgb (JSContext *cx, int result; SwfdecMovie *movie = JS_GetPrivate (cx, obj); - g_assert (movie); + if (!movie) + return JS_TRUE; result = (movie->color_transform.rb << 16) | ((movie->color_transform.gb % 256) << 8) | (movie->color_transform.bb % 256); @@ -55,7 +56,8 @@ swfdec_js_color_get_transform (JSContext JSObject *ret; SwfdecMovie *movie = JS_GetPrivate (cx, obj); - g_assert...
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
...100 implement WaitForFrame2 videostar.swf works now diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 39b3b8b..c416f64 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -267,6 +267,27 @@ swfdec_action_goto_label (JSContext *cx, return JS_TRUE; } +static int +swfdec_value_to_frame (JSContext *cx, SwfdecMovie *movie, jsval val) +{ + int frame; + + if (JSVAL_IS_STRING (val)) { + const char *name = swfdec_js_to_string (cx, val); + if (name == NULL || + !SWFDEC_IS_SPRITE_MOVIE (movie)) + return -1; + if (strchr (nam...
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
...S ***/ +/** + * 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 + **/ +static inline JSBool +swfdec_script_ensure_stack (JSContext *cx, guint n_elements) +{ + JSStackFrame *fp = cx->fp; + guint current = (guint) (fp->sp - fp->spbase); + + if (current >= n_elements) + return JS_TRUE; + + if (n_elements > (guint...
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
...fdecAsContext *cx, guint action, const guint8 *data, guint len) { + SwfdecAsValue *val; const char *name; - cx->fp->sp -= 2; - name = swfdec_js_to_string (cx, cx->fp->sp[1]); - if (name == NULL) - return JS_FALSE; - if (!JSVAL_IS_OBJECT (cx->fp->sp[0])) - return JS_TRUE; - return JS_DeleteProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[0]), name); + name = swfdec_as_value_to_string (cx, swfdec_as_stack_pop (cx->frame->stack)); + val = swfdec_as_stack_pop (cx->frame->stack); + if (SWFDEC_AS_VALUE_IS_OBJECT (val)) + swfdec_as_object_delete_variabl...
2007 Apr 11
0
Branch 'as' - 4 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...ions diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c index 249f9cc..3989186 100644 --- a/libswfdec/swfdec_as_interpret.c +++ b/libswfdec/swfdec_as_interpret.c @@ -1831,41 +1831,24 @@ swfdec_action_enumerate2 (SwfdecAsContex JS_DestroyIdArray (cx, array); return JS_TRUE; } +#endif static void -swfdec_action_logical_5 (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) -{ - void l, r; - - l = swfdec_value_to_boolean_5 (cx, cx->fp->sp[-1]); - r = swfdec_value_to_boolean_5 (cx, cx->fp->sp[-2]); - - cx->fp->sp--; - if (action...
2007 Jun 01
0
Branch 'as' - 2 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c libswfdec/swfdec_interval.c libswfdec/swfdec_interval.h libswfdec/swfdec_player_as.c libswfdec/swfdec_player.c
...uint i, n_args, first_arg, msecs; - SwfdecAsInterval *interval; + guint id, msecs; +#define MIN_INTERVAL_TIME 10 - if (!JSVAL_IS_OBJECT (argv[0])) { + if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) { SWFDEC_WARNING ("first argument to setInterval is not an object"); - return JS_TRUE; + return; } - object = JSVAL_TO_OBJECT (argv[0]); - if (JS_GetClass (object) == &js_FunctionClass) { - fun = argv[0]; - object = JS_GetParent (cx, object); - if (object == NULL) { - SWFDEC_WARNING ("function has no parent?!"); - return JS_TRUE; + object =...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...+ } + + cx->fp->sp--; + return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); +} + +static JSBool swfdec_action_shift (JSContext *cx, guint action, const guint8 *data, guint len) { guint32 amount, value; @@ -1414,6 +1443,54 @@ swfdec_action_target_path (JSContext *cx return JS_TRUE; } +static JSBool +swfdec_action_define_local (JSContext *cx, guint action, const guint8 *data, guint len) +{ + const char *name; + + if (cx->fp->callobj == NULL) { + SWFDEC_ERROR ("FIXME: no local scope"); + return JS_FALSE; + } + name = swfdec_js_to_string (cx, cx-&gt...
2007 Mar 22
0
11 commits - libswfdec/swfdec_color.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_net_stream.h libswfdec/swfdec_pattern.c libswfdec/swfdec_script.c NEWS test/trace
...007 +0100 implement NetStream.seek diff --git a/libswfdec/swfdec_js_net_stream.c b/libswfdec/swfdec_js_net_stream.c index a977ea8..873f673 100644 --- a/libswfdec/swfdec_js_net_stream.c +++ b/libswfdec/swfdec_js_net_stream.c @@ -80,9 +80,25 @@ swfdec_js_net_stream_set_buffer_time (JS return JS_TRUE; } +static JSBool +swfdec_js_net_stream_seek (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + SwfdecNetStream *stream; + double d; + + stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); + if (stream == NULL) + return JS_TRUE; + if (!JS_Valu...