Displaying 20 results from an estimated 66 matches for "n_args".
Did you mean:
t_args
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
...+
+static void
+swfdec_interval_mark (SwfdecAsObject *object)
+{
+ guint i;
+ SwfdecInterval *interval = SWFDEC_INTERVAL (object);
+
+ swfdec_as_object_mark (interval->object);
+ if (interval->fun_name)
+ swfdec_as_string_mark (interval->fun_name);
+ for (i = 0; i < interval->n_args; i++) {
+ swfdec_as_value_mark (&interval->args[i]);
+ }
+
+ SWFDEC_AS_OBJECT_CLASS (swfdec_interval_parent_class)->mark (object);
+}
+
+static void
+swfdec_interval_dispose (GObject *object)
+{
+ SwfdecInterval *interval = SWFDEC_INTERVAL (object);
+
+ g_free (interval->args);...
2007 Nov 14
0
7 commits - libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_super.c libswfdec/swfdec_as_super.h
.../libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -876,6 +876,7 @@ swfdec_action_call_method (SwfdecAsContext *cx, guint action, const guint8 *data
SwfdecAsFrame *frame = cx->frame;
SwfdecAsValue *val;
SwfdecAsObject *obj;
+ SwfdecAsObject *pobj = NULL;
guint n_args;
const char *name;
@@ -892,7 +893,7 @@ swfdec_action_call_method (SwfdecAsContext *cx, guint action, const guint8 *data
name = "";
} else {
SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_peek (cx, 3), obj);
- swfdec_as_object_get_variable (obj, name, swfdec_as_...
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
...c
@@ -1327,54 +1327,44 @@ fail:
SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx->frame->stack, 1));
}
-#if 0
static void
swfdec_action_new_method (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- JSStackFrame *fp = cx->fp;
- const char *s;
- guint32 n_args;
- JSObject *object;
- jsval constructor;
-
- if (!swfdec_script_ensure_stack (cx, 3))
- return JS_FALSE;
- s = swfdec_js_to_string (cx, fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
- if (!JS_ValueToECMAUint32 (cx, fp->sp[-3], &n_args))
- return JS_FALSE;
-
- if (!...
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
...ript.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, stacksize - 2);
+ n_args = stacksize - 2;
+ if (!swfdec_script_ensure_stack (cx, n_args...
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
...ntextPrivate (cx);
+ const char *bytes;
+
+ bytes = swfdec_js_to_string (cx, cx->fp->sp[-1]);
+ cx->fp->sp--;
+ if (bytes == NULL)
+ return JS_TRUE;
+
+ swfdec_player_trace (player, bytes);
+ return JS_TRUE;
+}
+
+/**
+ * swfdec_action_invoke:
+ * @cx: the #SwfdecAsContext
+ * @n_args: number of arguments
+ *
+ * This function is similar to js_Invoke, however it uses a reversed stack
+ * order. sp[-1] has to be the function to call, sp[-2] will be the object the
+ * function is called on, sp[-3] is the first argument, followed by the rest of
+ * the arguments. The function remo...
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
...x->fp->spend - cx->fp->sp;
swfdec_bits_init_data (&bits, data, len);
while (swfdec_bits_left (&bits) && stackspace-- > 0) {
@@ -644,7 +681,7 @@ swfdec_action_call_function (JSContext *
return JS_FALSE;
if (!JS_ValueToECMAUint32 (cx, fp->sp[-2], &n_args))
return JS_FALSE;
- if (n_args + 2 > (guint) (fp->sp - fp->spbase))
+ if (!swfdec_script_ensure_stack (cx, n_args + 2))
return JS_FALSE;
if (!(atom = js_Atomize (cx, s, strlen (s), 0)) ||
@@ -676,7 +713,7 @@ swfdec_action_call_method (JSContext *cx
return JS_FALSE;...
2007 Feb 16
0
11 commits - libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h test/.gitignore test/trace
...Feb 16 21:11:56 2007 +0100
use this as parent in DefineFunction
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 95a5561..9a9dd75 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -1439,10 +1439,10 @@ swfdec_action_do_define_function (JSCont
n_args = swfdec_bits_get_u16 (&bits);
if (*function_name == '\0') {
/* anonymous function */
- fun = JS_NewFunction (cx, NULL, n_args, JSFUN_LAMBDA, NULL, NULL);
+ fun = JS_NewFunction (cx, NULL, n_args, JSFUN_LAMBDA, cx->fp->thisp, NULL);
} else {
/* named function...
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
...def struct _SwfdecJSInterval SwfdecJSInterval;
+struct _SwfdecJSInterval {
+ SwfdecTimeout timeout;
+ SwfdecPlayer * player; /* needed so it can be readded */
+ unsigned int id; /* id this interval is identified with */
+ unsigned int msecs; /* interval in milliseconds */
+ unsigned int n_args; /* number of arguments to call function with */
+ jsval vals[0]; /* values: 0 is function, 1 is object, 2-n are arguments */
+};
+
+void
+swfdec_js_interval_free (SwfdecJSInterval *interval)
+{
+ JSContext *cx = interval->player->jscx;
+ guint i;
+
+ swfdec_player_remove_timeout (inte...
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
...ext);
swfdec_as_object_unroot (ret);
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index a1a3625..f0d27ce 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1112,7 +1112,7 @@ swfdec_action_create (SwfdecAsFunction *
}
if (n_args)
swfdec_as_stack_pop_n (stack, n_args);
- object = swfdec_as_object_create (fun, n_args, swfdec_as_stack_peek (stack, 0));
+ object = swfdec_as_object_create (fun, n_args, swfdec_as_stack_peek (stack, 0), TRUE);
g_assert (object);
SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_peek (stack...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
....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))->clasp;
- object = JS_NewObject (cx, clasp, NULL, NULL);
+ if (!JS_GetProperty (cx, object, "protot...
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
...ion.c b/libswfdec/swfdec_as_function.c
index 65540d2..653efea 100644
--- a/libswfdec/swfdec_as_function.c
+++ b/libswfdec/swfdec_as_function.c
@@ -107,13 +107,16 @@ swfdec_as_function_new_native (SwfdecAsC
}
void
-swfdec_as_function_call (SwfdecAsFunction *function, SwfdecAsObject *thisp, guint n_args)
+swfdec_as_function_call (SwfdecAsFunction *function, SwfdecAsObject *thisp, guint n_args,
+ SwfdecAsValue *args, SwfdecAsValue *return_value)
{
SwfdecAsContext *context;
SwfdecAsFrame *frame;
g_return_if_fail (SWFDEC_IS_AS_FUNCTION (function));
g_return_if_fail (SWFDEC_IS_AS_OBJ...
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
...746 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 - fp->spbase) < 2 * n_args + 1) {
+ SWFDEC_ERROR ("not enough stack space");
+ return JS_FALSE;
+ }
+
+ object = JS_NewObject (cx, &js_ObjectClass, NULL, NUL...
2007 Jul 13
0
12 commits - AUTHORS doc/Makefile.am doc/swfdec-docs.sgml doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_array.c libswfdec/swfdec_as_array.h libswfdec/swfdec_as_context.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h
...wfdecAsNativeFunction, swfdec_as_native_function, SWFDEC_TYPE_AS_FUNCTION)
@@ -97,6 +103,21 @@ swfdec_as_native_function_init (SwfdecAs
{
}
+/**
+ * swfdec_as_native_function_new:
+ * @context: a #SwfdecAsContext
+ * @name: name of the function
+ * @native: function to call when executed
+ * @min_args: minimum number of arguments required
+ *
+ * Creates a new native function, that will execute @native when called. The
+ * @min_args parameter sets a requirement for the minimum number of arguments
+ * to pass to @native. If the function gets called with less arguments, it
+ * will just redurn und...
2007 Nov 07
0
7 commits - doc/swfdec-sections.txt libswfdec-gtk/swfdec_gtk_widget.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_decoder.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_movie_asprops.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_player.c
...a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -104,11 +104,13 @@ swfdec_resource_loader_target_image (SwfdecResource *instance)
/* NB: name must be GC'ed */
static void
-swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, SwfdecAsValue *args, guint n_args)
+swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolean progress,
+ SwfdecAsValue *args, guint n_args)
{
SwfdecAsContext *cx;
SwfdecAsObject *movie;
- SwfdecAsValue vals[n_args + 2];
+ guint skip = progress ? 4 : 2;
+ SwfdecAsValue vals[n_args + skip];...
2007 Jul 07
0
Branch 'as' - 7 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_super.c libswfdec/swfdec_as_super.h libswfdec/swfdec_as_with.c test/trace
...ec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -560,7 +560,7 @@ swfdec_action_trace (SwfdecAsContext *cx
/* stack looks like this: [ function, this, arg1, arg2, ... ] */
/* stack must be at least 2 elements big */
static gboolean
-swfdec_action_call (SwfdecAsContext *cx, guint n_args, gboolean use_super)
+swfdec_action_call (SwfdecAsContext *cx, guint n_args)
{
SwfdecAsFunction *fun;
SwfdecAsObject *thisp;
@@ -592,11 +592,9 @@ swfdec_action_call (SwfdecAsContext *cx,
swfdec_as_stack_pop_n (frame->stack, n_args);
swfdec_as_function_call (fun, thisp, n_args, swf...
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
..._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 (s == NULL)
@@ -561,7 +563,9 @@ swfdec_action_call_function (JSContext *
if (n_args + 2 > (guint) (fp->sp - fp->spbase))
return...
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
...libswfdec/swfdec_as_object.h
@@ -22,7 +22,6 @@
#include <glib-object.h>
#include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_types.h>
G_BEGIN_DECLS
@@ -143,8 +142,6 @@ SwfdecAsFunction *swfdec_as_object_add_f
SwfdecAsNative native,
guint min_args);
-void swfdec_as_object_run (SwfdecAsObject * object,
- SwfdecScript * script);
gboolean swfdec_as_object_has_function (SwfdecAsObject * object,
const char * name);
void swfdec_as_object_call (SwfdecAsObject * object,
diff-tree d617bb496e5aa49a138dd34a62dc...
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
...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_args;
- if (!JS_ValueToECMAUint32 (cx, fp->sp[-1], &n_args))
- return JS_FALSE;
- if (!swfdec_script_ensure_stack (cx, 2 * n_args + 1))
- return JS_FALSE;
+ n_args = swfdec_as_...
2007 Jul 04
0
Branch 'as' - 25 commits - libswfdec/Makefile.am libswfdec/swfdec_as_boolean.c libswfdec/swfdec_as_boolean.h 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
...ve g_prints
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index f762252..bbe8060 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -593,10 +593,9 @@ swfdec_action_call (SwfdecAsContext *cx,
swfdec_as_function_call (fun, thisp, n_args, swfdec_as_stack_peek (frame->stack, 0),
swfdec_as_stack_peek (frame->stack, 1));
if (use_super) {
- g_print ("replacing super object\n");
if (cx->frame->super && SWFDEC_AS_SUPER (frame->super)->object) {
+ SWFDEC_LOG ("replacing supe...
2007 May 18
0
Branch 'as' - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_native_function.h
...ec_as_object.h"
#include "swfdec_as_stack.h"
@@ -389,10 +390,11 @@ start:
frame = context->frame;
if (frame == context->last_frame)
goto out;
- if (frame->function && frame->function->native) {
- if (frame->argc >= frame->function->min_args &&
- g_type_is_a (G_OBJECT_TYPE (frame->thisp), frame->function->type)) {
- frame->function->native (frame->thisp, frame->argc, frame->argv, frame->return_value);
+ if (SWFDEC_IS_AS_NATIVE_FUNCTION (frame->function)) {
+ SwfdecAsNativeFunction *native...