Displaying 20 results from an estimated 38 matches for "swfdec_js_to_str".
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
...@@ -1652,41 +1652,29 @@ swfdec_action_return (SwfdecAsContext *c
swfdec_as_context_return (cx);
}
-#if 0
static void
swfdec_action_delete (SwfdecAsContext *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->...
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
...ie_goto (movie, frame);
+ movie->stopped = TRUE;
+ } else {
+ SWFDEC_ERROR ("no movie to goto on");
+ }
+}
+
+#if 0
+static int
+swfdec_value_to_frame (SwfdecAsContext *cx, SwfdecMovie *movie, jsval val)
+{
+ int frame;
+
+ if (JSVAL_IS_STRING (val)) {
+ const char *name = swfdec_js_to_string (cx, val);
+ char *end;
+ if (name == NULL ||
+ !SWFDEC_IS_SPRITE_MOVIE (movie))
+ return -1;
+ if (strchr (name, ':')) {
+ SWFDEC_ERROR ("FIXME: handle targets");
+ }
+ /* treat valid encoded numbers as numbers, otherwise assume it's a frame...
2007 Mar 07
1
2 commits - libswfdec/swfdec_script.c test/trace
...ndle weird cases
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 88b1b1d..7d93740 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -291,16 +291,26 @@ swfdec_value_to_frame (JSContext *cx, Sw
if (JSVAL_IS_STRING (val)) {
const char *name = swfdec_js_to_string (cx, val);
+ char *end;
if (name == NULL ||
!SWFDEC_IS_SPRITE_MOVIE (movie))
return -1;
if (strchr (name, ':')) {
SWFDEC_ERROR ("FIXME: handle targets");
}
- frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, nam...
2007 Mar 07
0
2 commits - libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.h
...:23 2007 +0100
warn about not handling initObject
diff --git a/libswfdec/swfdec_js_movie.c b/libswfdec/swfdec_js_movie.c
index 3d04d92..200f706 100644
--- a/libswfdec/swfdec_js_movie.c
+++ b/libswfdec/swfdec_js_movie.c
@@ -395,6 +395,9 @@ swfdec_js_movie_attachMovie (JSContext *
export = swfdec_js_to_string (cx, argv[0]);
name = swfdec_js_to_string (cx, argv[1]);
+ if (argc > 3) {
+ SWFDEC_ERROR ("attachMovie's initObject isn't implemented");
+ }
if (export == NULL || name == NULL)
return JS_FALSE;
sprite = swfdec_root_movie_get_export (SWFDEC_ROOT_MOVIE (mov...
2007 Feb 01
0
Branch 'interpreter' - libswfdec/swfdec_script.c
...ibswfdec/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");
+ }
+ frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
+ } else {...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...;
if (object == NULL)
return JS_FALSE;
fp->sp[-2] = OBJECT_TO_JSVAL (object);
@@ -1436,7 +1441,7 @@ swfdec_action_new_method (JSContext *cx,
const char *s;
guint32 n_args;
JSObject *object;
- jsval constructor;
+ jsval constructor, proto;
const JSClass *clasp;
s = swfdec_js_to_string (cx, fp->sp[-1]);
@@ -1467,7 +1472,12 @@ swfdec_action_new_method (JSContext *cx,
if (JS_GetClass (object) != &js_FunctionClass)
goto fail;
clasp = ((JSFunction *) JS_GetPrivate (cx, object))->clasp;
- object = JS_NewObject (cx, clasp, NULL, NULL);
+ if (!JS_GetProperty (c...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...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->fp->sp[-2]);
+ if (name == NULL)
+ return JS_FALSE;
+ if (!JS_SetProperty (cx, cx->fp->callobj, name, &cx->fp->sp[-1]))
+ return JS_FALSE;
+ cx->fp->sp -= 2;
+ return JS_TRUE;
+}
+
+static JSBool
+swfdec_action_define_local2 (JSContext *cx, guint ac...
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
...ext *
SwfdecContent *content;
SwfdecGraphic *sprite;
- movie = JS_GetPrivate (cx, obj);
- g_assert (movie);
+ movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE);
+ if (movie == NULL) {
+ SWFDEC_WARNING ("not a movie");
+ return JS_TRUE;
+ }
export = swfdec_js_to_string (cx, argv[0]);
name = swfdec_js_to_string (cx, argv[1]);
@@ -518,8 +566,11 @@ swfdec_js_movie_duplicateMovieClip (JSCo
int depth;
SwfdecContent *content;
- movie = JS_GetPrivate (cx, obj);
- g_assert (movie);
+ movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE);
+...
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
...@@ void swfdec_js_movie_remove_property (S
char * swfdec_js_slash_to_dot (const char * slash_str);
jsval swfdec_js_eval (JSContext * cx,
JSObject * obj,
- const char * str);
+ const char * str,
+ gboolean ignore_case);
/* support functions */
const char * swfdec_js_to_string (JSContext * cx,
diff --git a/libswfdec/swfdec_js_global.c b/libswfdec/swfdec_js_global.c
index 328d74d..27522c1 100644
--- a/libswfdec/swfdec_js_global.c
+++ b/libswfdec/swfdec_js_global.c
@@ -33,7 +33,7 @@ swfdec_js_global_eval (JSContext *cx, JS
const char *bytes = swfdec_js_to_string...
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
...NULL in _eval of SetVariable and GetVariable to walk the scope chain
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index a3bb563..7848e14 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -316,7 +316,7 @@ swfdec_action_get_variable (JSContext *c
s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
if (s == NULL)
return JS_FALSE;
- cx->fp->sp[-1] = swfdec_js_eval (cx, cx->fp->scopeChain, s);
+ cx->fp->sp[-1] = swfdec_js_eval (cx, NULL, s);
return JS_TRUE;
}
@@ -329,7 +329,7 @@ swfdec_action_set_variable (JSContext *c
if (s ==...
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
...ize - 2;
+ if (!swfdec_script_ensure_stack (cx, n_args + 2))
+ return JS_FALSE;
+ }
j = -1;
i = - (n_args + 2);
@@ -677,13 +685,13 @@ swfdec_action_call_function (JSContext *
jsval fun;
JSAtom *atom;
+ if (!swfdec_script_ensure_stack (cx, 2))
+ return JS_FALSE;
s = swfdec_js_to_string (cx, fp->sp[-1]);
if (s == NULL)
return JS_FALSE;
if (!JS_ValueToECMAUint32 (cx, fp->sp[-2], &n_args))
return JS_FALSE;
- if (!swfdec_script_ensure_stack (cx, n_args + 2))
- return JS_FALSE;
if (!(atom = js_Atomize (cx, s, strlen (s), 0)) ||
!js_FindPr...
2007 Mar 20
0
9 commits - configure.ac libswfdec/swfdec_bits.c libswfdec/swfdec_debug.c libswfdec/swfdec_js.c libswfdec/swfdec_script.c libswfdec/swfdec_sound.c
...x->fp->sp[-1] == JSVAL_VOID) {
+ SWFDEC_WARNING ("no variable named %s", s);
+ }
+#endif
return JS_TRUE;
}
@@ -1066,14 +1076,24 @@ static JSBool
swfdec_action_get_member (JSContext *cx, guint action, const guint8 *data, guint len)
{
const char *s;
+ jsval o;
s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
if (s == NULL)
return JS_FALSE;
- if (JSVAL_IS_OBJECT (cx->fp->sp[-2]) && !JSVAL_IS_NULL (cx->fp->sp[-2])) {
- if (!JS_GetProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[-2]), s, &cx->fp->sp[-2]))
- return JS_FALSE;
+...
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
...static void
swfdec_action_pop (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- cx->fp->sp--;
- return JS_TRUE;
-}
-
-static const char *
-swfdec_eval_jsval (SwfdecAsContext *cx, JSObject *obj, jsval *val)
-{
- if (JSVAL_IS_STRING (*val)) {
- const char *bytes = swfdec_js_to_string (cx, *val);
- if (bytes == NULL)
- return NULL;
- *val = swfdec_js_eval (cx, obj, bytes);
- return bytes;
- } else {
- if (obj == NULL) {
- obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
- }
- *val = OBJECT_TO_JSVAL (obj);
- return ".";
- }
-}
-...
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
...= *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 (s == NULL)
@@ -561,7 +563,9 @@ swfdec_action_call_function (JSContext *
if (n_args + 2 > (guint) (fp->sp - fp->spbase))
return JS_FALSE;
- obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
+ if (!(atom = js_Atomize (cx, s, strlen (s), 0)) ||...
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
...ec_script.c
index d46687f..824861b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -1643,11 +1643,11 @@ swfdec_action_define_local (JSContext *c
{
const char *name;
- g_assert (cx->fp->callobj != NULL);
+ g_assert (cx->fp->scopeChain != NULL);
name = swfdec_js_to_string (cx, cx->fp->sp[-2]);
if (name == NULL)
return JS_FALSE;
- if (!JS_SetProperty (cx, cx->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;
r...
2007 Apr 04
0
Branch 'as' - 9 commits - 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_stack.c libswfdec/swfdec_as_stack.h
...00644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -512,22 +512,18 @@ swfdec_action_push (SwfdecAsContext *cx,
}
}
-#if 0
static void
swfdec_action_get_variable (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
const char *s;
- s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
- cx->fp->sp[-1] = swfdec_js_eval (cx, NULL, s);
+ s = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx->frame->stack, 1));
+ swfdec_as_context_eval (cx, NULL, s, swfdec_as_stack_peek (cx->frame->stac...
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
...ibswfdec/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");
+ }
+ frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
+ } else {...
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
...+242,28 @@ static JSFunctionSpec global_methods[] =
{ NULL, NULL, 0, 0, 0 }
};
+static JSBool
+swfdec_js_object_register_class (JSContext *cx, JSObject *obj, uintN argc,
+ jsval *argv, jsval *rval)
+{
+ SwfdecPlayer *player = JS_GetContextPrivate (cx);
+ const char *name;
+
+ name = swfdec_js_to_string (cx, argv[0]);
+ if (name == NULL)
+ return JS_FALSE;
+ if (!JSVAL_IS_OBJECT(argv[1]))
+ return JS_FALSE;
+
+ swfdec_player_set_export_class (player, name, argv[1]);
+ return JS_TRUE;
+}
+
+static JSFunctionSpec static_object_methods[] = {
+ { "registerClass", swfdec_js...
2007 Mar 07
0
13 commits - libswfdec/Makefile.am libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c
...+swfdec_js_movie_attachMovie (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+ SwfdecMovie *movie, *ret;
+ const char *name, *export;
+ int depth;
+ SwfdecContent *content;
+ SwfdecGraphic *sprite;
+
+ movie = JS_GetPrivate (cx, obj);
+ g_assert (movie);
+
+ export = swfdec_js_to_string (cx, argv[0]);
+ name = swfdec_js_to_string (cx, argv[1]);
+ if (export == NULL || name == NULL)
+ return JS_FALSE;
+ sprite = swfdec_root_movie_get_export (SWFDEC_ROOT_MOVIE (movie->root), export);
+ if (!SWFDEC_IS_SPRITE (sprite)) {
+ if (sprite == NULL) {
+ SWFDEC_WARNING (&...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...ighquality", "_focusrect", "_soundbuftime", "_quality",
- "_xmouse", "_ymouse"
-};
-
-static JSBool
+static const char *
swfdec_eval_jsval (JSContext *cx, JSObject *obj, jsval *val)
{
if (JSVAL_IS_STRING (*val)) {
const char *bytes = swfdec_js_to_string (cx, *val);
if (bytes == NULL)
- return JS_FALSE;
+ return NULL;
*val = swfdec_js_eval (cx, obj, bytes);
+ return bytes;
} else {
- if (obj == NULL)
+ if (obj == NULL) {
obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
+ }
*val = OBJECT_TO_JSVA...