Displaying 20 results from an estimated 26 matches for "string_to_jsv".
Did you mean:
string_to_jsval
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
...f JS_HAS_INITIALIZERS
- if (cx->version == JSVERSION_1_2)
- 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 (!...
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
...249,6 +249,15 @@ IntToString(jsint i, char *buf, size_t b
static JSBool
num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
+ JSString *string;
+
+ string = JS_InternString (cx, "[type Object]");
+ if (string == NULL)
+ return JS_FALSE;
+
+ *rval = STRING_TO_JSVAL (string);
+ return JS_TRUE;
+#if 0
jsval v;
jsdouble d;
jsint base;
@@ -286,6 +295,7 @@ num_toString(JSContext *cx, JSObject *ob
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
+#endif
}
static JSBool
diff-tree c806924bb1038dd655fef7d2ede3dad8d61dffe...
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
...uot;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_js_net_stream_to_string, 0, 0, 0 },
+ {0,0,0,0,0}
+};
+
+static void
+swfdec_js_net_stream_finalize (JSContext *cx, JSObject *obj)
+{
+ SwfdecNetStream *stream;
+
+ stream = JS_...
2007 Apr 11
0
Branch 'as' - 4 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...break;
+ default:
+ g_assert_not_reached ();
+ type = SWFDEC_AS_STR_EMPTY;
+ break;
}
- /* can't use InternString here because of case sensitivity issues */
- string = JS_NewStringCopyZ (cx, type);
- if (string == NULL)
- return JS_FALSE;
- cx->fp->sp[-1] = STRING_TO_JSVAL (string);
- return JS_TRUE;
+ SWFDEC_AS_VALUE_SET_STRING (val, type);
}
+#if 0
static void
swfdec_action_get_time (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
@@ -2218,7 +2222,9 @@ const SwfdecActionSpec swfdec_as_actions
[0x41] = { "DefineLocal2", NUL...
2007 Mar 13
0
4 commits - test/swfscript.c
...ZERS || JS_HAS_TOSOURCE */
-extern const JSClass movieclip_class;
+extern int swfdec_js_is_movieclip (JSContext *cx, JSObject *obj);
extern char *swfdec_movie_get_path (void *movieclip);
extern void g_free (void *p);
JSBool
@@ -921,7 +921,7 @@ js_obj_toString(JSContext *cx, JSObject
*rval = STRING_TO_JSVAL(cx->runtime->emptyString);
return JS_TRUE;
}
- if (clasp == &movieclip_class) {
+ if (swfdec_js_is_movieclip (cx, obj)) {
void *p = JS_GetPrivate (cx, obj);
if (p) {
char *path = swfdec_movie_get_path (p);
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
...R ("no 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)) {
+ d...
2007 Jun 20
1
Branch 'as' - 2 commits - libswfdec/swfdec_as_interpret.c
libswfdec/swfdec_as_interpret.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
New commits:
diff-tree 9c5cb7cb9f6278896bc8a1e7cd7fb541b079c8de (from 1e19719b58b5cfcb800c81a5f5432c3ad662dbbc)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jun 20 20:58:52 2007 +0200
the modulo arguments were mixed
diff --git a/libswfdec/swfdec_as_interpret.c
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
...x, gui
l = l * r;
break;
case 0x0d:
- if (isnan (r))
- r = 0;
- if (r == 0 && ((SwfdecScript *) cx->fp->swf)->version < 5) {
- JSString *str = JS_InternString (cx, "#ERROR#");
- if (str == NULL)
- return JS_FALSE;
- cx->fp->sp[-1] = STRING_TO_JSVAL (str);
- return JS_TRUE;
- } else if (((SwfdecScript *) cx->fp->swf)->version >= 7 &&
- r == 0) {
- cx->fp->sp[-1] = DOUBLE_TO_JSVAL (r < 0 ?
- cx->runtime->jsNegativeInfinity :
- cx->runtime->jsPositiveInfinity);
- return JS_TRUE;
+ i...
2007 Apr 04
0
Branch 'as' - 17 commits - configure.ac doc/Makefile.am doc/swfdec-docs.sgml doc/swfdec-sections.txt doc/swfdec.types libswfdec-gtk/Makefile.am libswfdec-gtk/swfdec-gtk.h libswfdec-gtk/swfdec_gtk_loader.c libswfdec-gtk/swfdec_gtk_loader.h
...*bits, SwfdecAsValue *val)
{
guint len = swfdec_bits_get_bu16 (bits);
char *s;
- JSString *string;
s = swfdec_bits_get_string_length (bits, len);
if (s == NULL)
return FALSE;
-
- string = JS_NewStringCopyZ (cx, s);
- g_free (s);
- if (!string)
- return FALSE;
- *val = STRING_TO_JSVAL (string);
+ SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_get_string (context, s));
return TRUE;
}
+
static gboolean
-swfdec_amf_parse_properties (JSContext *cx, SwfdecBits *bits, jsval *val)
+swfdec_amf_parse_properties (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsObject *obje...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...+ type = "object";
+ }
+ } else {
+ g_assert_not_reached ();
+ return JS_FALSE;
+ }
+ /* can't use InternString here because of case sensitivity issues */
+ string = JS_NewStringCopyZ (cx, type);
+ if (string == NULL)
+ return JS_FALSE;
+ cx->fp->sp[-1] = STRING_TO_JSVAL (string);
+ return JS_TRUE;
+}
+
/*** PRINT FUNCTIONS ***/
static char *
@@ -2260,7 +2299,7 @@ static const SwfdecActionSpec actions[25
[0x41] = { "DefineLocal2", NULL, 1, 0, { NULL, NULL, swfdec_action_define_local2, swfdec_action_define_local2, swfdec_action_define_local2 } },...
2007 Mar 14
0
10 commits - libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_flv_decoder.h libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_loadertarget.c
...*code, const char *level)
+{
+ jsval val;
+ JSString *string;
+ JSObject *object;
+ JSContext *cx;
+
+ cx = stream->player->jscx;
+ object = JS_NewObject (cx, NULL, NULL, NULL);
+ if (!object)
+ return;
+ string = JS_NewStringCopyZ (cx, code);
+ if (!string)
+ return;
+ val = STRING_TO_JSVAL (string);
+ if (!JS_SetProperty (cx, object, "code", &val))
+ return;
+ string = JS_NewStringCopyZ (cx, level);
+ if (!string)
+ return;
+ val = STRING_TO_JSVAL (string);
+ if (!JS_SetProperty (cx, object, "level", &val))
+ return;
+
+ val = OBJECT_TO_JS...
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
...variables);
- g_free (name);
- g_free (value);
- break;
- }
- string = JS_NewStringCopyZ (script->jscx, value);
- if (string == NULL) {
- g_free (name);
- g_free (value);
- SWFDEC_ERROR ("could not create string");
- break;
- }
- val = STRING_TO_JSVAL (string);
- if (!JS_SetProperty (script->jscx, object, name, &val)) {
- g_free (name);
- g_free (value);
- SWFDEC_ERROR ("error setting property \"%s\"", name);
- break;
- }
- SWFDEC_DEBUG ("Set variable \"%s\" to \"%s\&q...
2007 Feb 17
0
8 commits - configure.ac doc/swfdec-sections.txt libswfdec/swfdec_loader.c libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_root_movie.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h
...g_free (name);
+ g_free (value);
+ break;
+ }
+ variables++;
+ string = JS_NewStringCopyZ (script->jscx, value);
+ if (string == NULL) {
+ g_free (name);
+ g_free (value);
+ SWFDEC_ERROR ("could not create string");
+ break;
+ }
+ val = STRING_TO_JSVAL (string);
+ if (!JS_SetProperty (script->jscx, object, name, &val)) {
+ g_free (name);
+ g_free (value);
+ SWFDEC_ERROR ("error setting property \"%s\"", name);
+ break;
+ }
+ SWFDEC_DEBUG ("Set variable \"%s\" to \"%s\&q...
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
...gt;sp[-1], SWFDEC_TYPE_MOVIE);
+
+ if (movie == NULL) {
+ cx->fp->sp[-1] = JSVAL_VOID;
+ } else {
+ char *s = swfdec_movie_get_path (movie);
+ JSString *string = JS_NewStringCopyZ (cx, s);
+ g_free (s);
+ if (string == NULL)
+ return JS_FALSE;
+ cx->fp->sp[-1] = STRING_TO_JSVAL (string);
+ }
+ return JS_TRUE;
+}
+
/*** PRINT FUNCTIONS ***/
static char *
@@ -1431,6 +1561,26 @@ swfdec_action_print_constant_pool (guint
}
static char *
+swfdec_action_print_goto_frame2 (guint action, const guint8 *data, guint len)
+{
+ gboolean play, bias;
+ SwfdecBits bits;
+
+...
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
...rget (SwfdecAsContext *context)
@@ -60,16 +61,6 @@ swfdec_action_get_target (SwfdecAsContex
#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)) {
@@ -407,123 +398,121 @@ swfdec_action_wait_for_frame (SwfdecAsCo
swfdec_script_skip_actions (cx, jump);
}
-#if 0
static void
swfdec_action_const...
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
...+ rval = JS_ValueToString (cx, cx->fp->sp[-1]);
+ lval = JS_ValueToString (cx, cx->fp->sp[-2]);
+ if (lval == NULL || rval == NULL)
+ return FALSE;
+ lval = JS_ConcatStrings (cx, lval, rval);
+ if (lval == NULL)
+ return FALSE;
+ cx->fp->sp--;
+ cx->fp->sp[-1] = STRING_TO_JSVAL (lval);
+ return JS_TRUE;
+}
+
/*** PRINT FUNCTIONS ***/
static char *
+swfdec_action_print_get_url (guint action, const guint8 *data, guint len)
+{
+ SwfdecBits bits;
+ const char *url, *target;
+
+ swfdec_bits_init_data (&bits, data, len);
+ url = swfdec_bits_skip_string (&bits...
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
...249,6 +249,15 @@ IntToString(jsint i, char *buf, size_t b
static JSBool
num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
+ JSString *string;
+
+ string = JS_InternString (cx, "[type Object]");
+ if (string == NULL)
+ return JS_FALSE;
+
+ *rval = STRING_TO_JSVAL (string);
+ return JS_TRUE;
+#if 0
jsval v;
jsdouble d;
jsint base;
@@ -286,6 +295,7 @@ num_toString(JSContext *cx, JSObject *ob
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
+#endif
}
static JSBool
diff-tree c806924bb1038dd655fef7d2ede3dad8d61dffe...
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
...ALSE;
+ }
+ cx->fp->sp--;
switch (action) {
case 0x0a:
l = l + r;
@@ -557,17 +564,22 @@ swfdec_action_binary (JSContext *cx, gui
JSString *str = JS_InternString (cx, "#ERROR#");
if (str == NULL)
return JS_FALSE;
- cx->fp->sp--;
cx->fp->sp[-1] = STRING_TO_JSVAL (str);
return JS_TRUE;
}
+ if (((SwfdecScript *) cx->fp->swf)->version >= 7 &&
+ JSVAL_IS_VOID (rval)) {
+ cx->fp->sp[-1] = DOUBLE_TO_JSVAL (r < 0 ?
+ cx->runtime->jsNegativeInfinity :
+ cx->runtime->jsPositiveInfinity);
+ return J...
2007 Mar 05
0
11 commits - configure.ac libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_swf_decoder.c
...l = swfdec_value_to_number (cx, lval);
+ r = swfdec_value_to_number (cx, rval);
} else {
if (!swfdec_value_to_number_7 (cx, lval, &l) ||
!swfdec_value_to_number_7 (cx, rval, &r))
@@ -901,8 +901,8 @@ swfdec_action_add2_5 (JSContext *cx, gui
cx->fp->sp[-1] = STRING_TO_JSVAL (str);
} else {
double d, d2;
- d = swfdec_action_to_number (cx, lval);
- d2 = swfdec_action_to_number (cx, rval);
+ d = swfdec_value_to_number (cx, lval);
+ d2 = swfdec_value_to_number (cx, rval);
d += d2;
cx->fp->sp--;
return JS_NewNumberValue(cx, d, &am...
2007 Jan 18
0
Branch 'interpreter' - 4 commits - libswfdec/js libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_codec_screen.c libswfdec/swfdec_image.c libswfdec/swfdec_script.c libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_tag.c
...n swfdec_scriptable_from_jsval (cx, OBJECT_TO_JSVAL (cx->fp->scopeChain), SWFDEC_TYPE_MOVIE);
}
+static JSBool
+swfdec_action_push_string (JSContext *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;
+}
+
/*** ALL THE ACTION IS HERE ***/
static JSBool
@@ -130,9 +198,194 @@ swfdec_action_wait_for_frame (JSContext
return JS_TRUE;
}
+static JSBool
+swfdec_action_constant_pool (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ SwfdecConstant...