search for: jsval

Displaying 20 results from an estimated 50 matches for "jsval".

Did you mean: qsval
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
...cScr /*** SUPPORT FUNCTIONS ***/ +/** + * 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;...
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
...e with the official player diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 2860e24..4b17af1 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -650,8 +650,16 @@ swfdec_action_call (JSContext *cx, guint JSStackFrame *fp = cx->fp; int i, j; jsval tmp; + guint stacksize; - g_assert ((guint) (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, stack...
2007 Jan 26
0
Branch 'interpreter' - 9 commits - libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_debugger.c libswfdec/swfdec_debugger.h libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_event.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c
...SContext * return JS_FALSE; if (!prop) return JS_FALSE; - if (pobj) - obj = pobj; return OBJ_GET_PROPERTY (cx, obj, (jsid) prop->id, ret); } } @@ -345,7 +343,7 @@ static gboolean swfdec_js_eval_internal (JSContext *cx, JSObject *obj, const char *str, jsval *val, gboolean set) { - jsval cur; + jsval cur = JSVAL_NULL; char *work = NULL; SWFDEC_LOG ("eval called with \"%s\" on %p", str, obj); @@ -361,12 +359,10 @@ swfdec_js_eval_internal (JSContext *cx, goto out; obj = cx->fp->thisp; } - cur = OBJECT...
2007 Jun 27
0
Branch 'as' - 16 commits - configure.ac libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_script_function.c
...+23,56 @@ #include "swfdec_video.h" #include "swfdec_debug.h" -#include "swfdec_js.h" #include "swfdec_net_stream.h" #include "swfdec_player_internal.h" -static JSBool -swfdec_js_video_attach_video (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +static void +swfdec_video_attach_video (SwfdecAsContext *cx, SwfdecAsObject *obj, guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval) { + SwfdecVideoMovie *video = SWFDEC_VIDEO_MOVIE (obj); SwfdecNetStream *stream; - SwfdecVideoMovie *video; - - video = swfdec_scriptab...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...it a/libswfdec/swfdec_js_movie.c b/libswfdec/swfdec_js_movie.c index 5b730b3..2296078 100644 --- a/libswfdec/swfdec_js_movie.c +++ b/libswfdec/swfdec_js_movie.c @@ -87,7 +87,7 @@ mc_getBytesLoaded (JSContext *cx, JSObje } static JSBool -mc_getBytesTotal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +mc_getBytesTotal (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { SwfdecMovie *movie; SwfdecDecoder *dec; @@ -101,6 +101,23 @@ mc_getBytesTotal(JSContext *cx, JSObject } static JSBool +mc_getNextHighestDepth (JSContext *cx, JSObject *obj, uintN...
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
...VE_CONFIG_H -#include "config.h" -#endif - -#include "swfdec_net_stream.h" -#include "swfdec_debug.h" -#include "swfdec_js.h" -#include "swfdec_player_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_strea...
2007 Mar 01
0
7 commits - libswfdec/swfdec_connection.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h
...m.c b/libswfdec/swfdec_js_net_stream.c index 9f12dd0..ed9c81e 100644 --- a/libswfdec/swfdec_js_net_stream.c +++ b/libswfdec/swfdec_js_net_stream.c @@ -27,6 +27,23 @@ #include "swfdec_player_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_strea...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...swfdec_script.c b/libswfdec/swfdec_script.c index 01dd6ae..f00a6f1 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1387,7 +1387,7 @@ static JSBool swfdec_action_new_object (JSContext *cx, guint action, const guint8 *data, guint len) { JSStackFrame *fp = cx->fp; - jsval constructor; + jsval constructor, proto; JSObject *object; const JSClass *clasp; guint n_args; @@ -1414,7 +1414,12 @@ swfdec_action_new_object (JSContext *cx, if (JS_GetClass (object) != &js_FunctionClass) goto fail; clasp = ((JSFunction *) JS_GetPrivate (cx, object))->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
...o valid target"); + 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)) { + dou...
2007 Feb 19
0
22 commits - libswfdec/js libswfdec/swfdec_debugger.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_script.c
...x->fp->callobj, name, &cx->fp->sp[-1])) + if (!JS_SetProperty (cx, cx->fp->scopeChain, name, &cx->fp->sp[-1])) return JS_FALSE; cx->fp->sp -= 2; return JS_TRUE; @@ -1659,11 +1659,11 @@ swfdec_action_define_local2 (JSContext * const char *name; jsval val = JSVAL_VOID; - g_assert (cx->fp->callobj != NULL); + g_assert (cx->fp->scopeChain != NULL); name = swfdec_js_to_string (cx, cx->fp->sp[-1]); if (name == NULL) return JS_FALSE; - if (!JS_SetProperty (cx, cx->fp->callobj, name, &val)) + if (!JS_SetPro...
2007 Mar 01
0
11 commits - libswfdec/Makefile.am libswfdec/swfdec_connection.c libswfdec/swfdec_connection.h libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js.h libswfdec/swfdec_js_net_stream.c
...NFIG_H +#include "config.h" +#endif + +#include "swfdec_net_stream.h" +#include "swfdec_debug.h" +#include "swfdec_js.h" +#include "swfdec_player_internal.h" + +static JSBool +swfdec_js_net_stream_to_string (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + JSString *string; + + string = JS_InternString (cx, "[object Object]"); + if (string == NULL) + return JS_FALSE; + + *rval = STRING_TO_JSVAL (string); + return JS_TRUE; +} + +static JSFunctionSpec net_stream_methods[] = { + { "toString", swfdec...
2007 Jul 13
0
4 commits - configure.ac libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_object.h libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h NEWS
...L; - klass = g_type_class_peek (type); - if (klass == NULL) - return NULL; /* class doesn't exist -> no object of this type exists */ - if (!JS_InstanceOf (cx, object, klass->jsclass, NULL)) - return NULL; - return JS_GetPrivate (cx, object); -} - -/** - * swfdec_scriptable_from_jsval: - * @cx: a #JSContext - * @val: the jsval to convert - * @type: type of the object to get. - * - * Converts the given value @val to a #SwfdecScriptable, if it represents one. - * The object must be of @type, otherwise %NULL will be returned. - * - * Returns: the scriptable represented by @val or N...
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
...Tue May 22 21:55:22 2007 +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...
2007 Jan 16
0
9 commits - libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_audio_stream.c libswfdec/swfdec_audio_stream.h libswfdec/swfdec_cache.c libswfdec/swfdec_cached.c libswfdec/swfdec_cached.h libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_image.c
...bswfdec/swfdec_edittext_movie.c +++ b/libswfdec/swfdec_edittext_movie.c @@ -68,24 +68,23 @@ static void swfdec_edit_text_movie_iterate (SwfdecMovie *movie) { SwfdecEditTextMovie *text = SWFDEC_EDIT_TEXT_MOVIE (movie); - SwfdecPlayer *player; + SwfdecScriptable *parent; + JSObject *jsobj; jsval val; const char *s; if (text->text->variable == NULL) return; - player = SWFDEC_ROOT_MOVIE (movie->root)->player; - if (movie->parent->jsobj == NULL) { - swfdec_js_add_movie (movie->parent); - if (movie->parent->jsobj == NULL) - return; - } -...
2007 Jan 24
0
Branch 'interpreter' - 8 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_script.c test/swfdec_out.c test/swfdec_out.h test/swfedit_tag.c test/swfedit_token.c test/swfedit_token.h
...bj: #JSObject to use as a source for evaluating - * @str: The string to evaluate - * @ignore_case: TRUE for case insensitive evaluation - * - * This function works like the Actionscript eval function used on @obj. - * It handles both slash-style and dot-style notation. - * - * Returns: the value or JSVAL_VOID if no value was found. - **/ -jsval -swfdec_js_eval (JSContext *cx, JSObject *obj, const char *str, - gboolean ignore_case) +static JSBool +swfdec_js_eval_set_property (JSContext *cx, JSObject *obj, + const char *name, gboolean initial, gboolean ignore_case, jsval *ret) +{ + JSAtom *a...
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
...(i = 0; i < n_args; i++) { + const char *s = swfdec_js_to_string (cx, fp->sp[-3 - 2 * i]); + if (s == NULL) + return JS_FALSE; + if (!JS_SetProperty (cx, object, s, &fp->sp[-2 - 2 * i])) + return JS_FALSE; + } + fp->sp -= 2 * n_args; + fp->sp[-1] = OBJECT_TO_JSVAL (object); + return JS_TRUE; +} + /*** PRINT FUNCTIONS ***/ static char * @@ -1321,7 +1350,7 @@ static const SwfdecActionSpec actions[25 [0x40] = { "NewObject", NULL, -1, 1, { NULL, NULL, swfdec_action_new_object, swfdec_action_new_object, swfdec_action_new_object } }, [0x41] =...
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
...o 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 * JSStackFrame *fp = cx->fp; const char *s; guint32 n_args; - JSObject *obj...
2007 Feb 01
0
Branch 'interpreter' - libswfdec/swfdec_script.c
...fdec/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 (name, ':')) { + SWFDEC_ERROR ("FIXME: handle targets"); + }...
2007 Mar 19
0
7 commits - libswfdec/jpeg libswfdec/swfdec_button_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_video.c player/swfdec_debug_movies.c
...eam.c b/libswfdec/swfdec_js_net_stream.c index 46cb1dc..8348279 100644 --- a/libswfdec/swfdec_js_net_stream.c +++ b/libswfdec/swfdec_js_net_stream.c @@ -44,6 +44,28 @@ swfdec_js_net_stream_play (JSContext *cx } static JSBool +swfdec_js_net_stream_pause (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + SwfdecNetStream *stream; + gboolean playing; + + stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); + if (stream == NULL) + return JS_TRUE; + if (argc == 0) { + playing = !swfdec_net_stream_get_playing (stream); + } else { + JSBool b; +...
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
...fdec/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 (name, ':')) { + SWFDEC_ERROR ("FIXME: handle targets"); + }...