search for: swfdec_script_new

Displaying 20 results from an estimated 26 matches for "swfdec_script_new".

2007 Aug 09
0
Branch 'vivi' - 12 commits - libswfdec-gtk/swfdec_gtk_player.c libswfdec-gtk/swfdec_gtk_player.h libswfdec/Makefile.am libswfdec/swfdec_as_array.h libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_debugger.c
...+ + action = newSWFAction (code); + data = SWFAction_getByteCode (action, &len); + if (data == NULL || len == 0) { + if (error) + *error = vivi_ming_get_error (); + return NULL; + } + buffer = swfdec_buffer_new_and_alloc (len); + memcpy (buffer->data, data, len); + script = swfdec_script_new (buffer, "compiled script", 8); + return script; +} + diff --git a/vivified/core/vivi_ming.h b/vivified/core/vivi_ming.h new file mode 100644 index 0000000..98d3b85 --- /dev/null +++ b/vivified/core/vivi_ming.h @@ -0,0 +1,34 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte a...
2007 Mar 13
0
2 commits - libswfdec/swfdec_debugger.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h
...(SWFDEC_DEBUGGER (player), script); + script->debugger = player; + } +} + /** * swfdec_script_ensure_stack: * @cx: #JSContext to check @@ -1733,22 +1740,22 @@ swfdec_action_define_function (JSContext } if (name == NULL) name = "unnamed_function"; - script = swfdec_script_new_for_player (JS_GetContextPrivate (cx), - &bits, name, ((SwfdecScript *) cx->fp->swf)->version); + script = swfdec_script_new (&bits, name, ((SwfdecScript *) cx->fp->swf)->version); swfdec_buffer_unref (buffer); - if (cx->fp->constant_pool) { - script-...
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
...x 7ed820b..d988ad3 100644 --- a/libswfdec/swfdec_event.c +++ b/libswfdec/swfdec_event.c @@ -146,7 +146,7 @@ swfdec_event_list_parse (SwfdecEventList event.key = key; name = g_strconcat (description, ".", swfdec_event_list_condition_name (conditions), NULL); - event.script = swfdec_script_new (bits, name, version); + event.script = swfdec_script_new_for_player (list->player, bits, name, version); g_free (name); if (event.script) g_array_append_val (list->events, event); diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index e5c205f..a3bb563 100644 --...
2007 Apr 17
0
15 commits - libswfdec/jpeg libswfdec/swfdec_bits.c libswfdec/swfdec_edittext.c libswfdec/swfdec_font.c libswfdec/swfdec_image.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c libswfdec/swfdec_shape.c libswfdec/swfdec_sprite.c
...Apr 17 11:35:50 2007 +0200 fix swfcdec_script_new to not touch the SwfdecBits struct directly diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 5163ce7..d675207 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -2731,7 +2731,8 @@ SwfdecScript * swfdec_script_new (SwfdecBits *bits, const char *name, guint version) { SwfdecScript *script; - const guchar *start; + SwfdecBits org; + guint len; g_return_val_if_fail (bits != NULL, NULL); @@ -2740,8 +2741,8 @@ swfdec_script_new (SwfdecBits *bits, con return NULL; } - swfdec_bits_syncbit...
2007 Apr 17
0
Branch 'as' - 17 commits - libswfdec/jpeg libswfdec/swfdec_bits.c libswfdec/swfdec_font.c libswfdec/swfdec_image.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c libswfdec/swfdec_shape.c libswfdec/swfdec_sound.c libswfdec/swfdec_sprite.c
...Apr 17 11:35:50 2007 +0200 fix swfcdec_script_new to not touch the SwfdecBits struct directly diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 5163ce7..d675207 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -2731,7 +2731,8 @@ SwfdecScript * swfdec_script_new (SwfdecBits *bits, const char *name, guint version) { SwfdecScript *script; - const guchar *start; + SwfdecBits org; + guint len; g_return_val_if_fail (bits != NULL, NULL); @@ -2740,8 +2741,8 @@ swfdec_script_new (SwfdecBits *bits, con return NULL; } - swfdec_bits_syncbit...
2007 Feb 14
0
7 commits - libswfdec/swfdec_image.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h test/Makefile.am test/swfdec_out.c test/swfdec_out.h test/swfedit.c test/swfedit_list.c test/swfedit_tag.c test/swfedit_token.c test/swfedit_token.h test/swfscript.c
...fixup_jumps_foreach, &state); + g_array_free (state.actions, TRUE); +#if 0 + g_print ("got a new script in %u bytes - old script was %u bytes\n", + state.buffer->length, state.script->buffer->length); +#endif + swfdec_bits_init (&bits, state.buffer); + script = swfdec_script_new (&bits, state.script->name, state.script->version); + swfdec_buffer_unref (state.buffer); + g_assert (script); + swfedit_token_set (token, idx, script); + + return TRUE; +} + +static guint * +string_to_action_list (const char *list) +{ + char **actions = g_strsplit (list, ",&quo...
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
...decConstantPool * pool); -guint swfdec_constant_pool_size (SwfdecConstantPool * pool); -const char * swfdec_constant_pool_get (SwfdecConstantPool * pool, - guint i); -SwfdecBuffer * swfdec_constant_pool_get_area (SwfdecScript * script, - SwfdecConstantPool * pool); - -SwfdecScript * swfdec_script_new (SwfdecBits * bits, - const char * name, - guint version); -SwfdecScript * swfdec_script_new_for_player (SwfdecPlayer * player, - SwfdecBits * bits, - const char * name, - guint version); -SwfdecScript * swfdec_script_ref (SwfdecScript * script); -void s...
2007 Aug 22
0
163 commits - autogen.sh configure.ac doc/swfdec-sections.txt libswfdec-gtk/swfdec_gtk_player.c libswfdec-gtk/swfdec_gtk_player.h libswfdec-gtk/swfdec_gtk_widget.c libswfdec-gtk/swfdec_source.c libswfdec/Makefile.am libswfdec/swfdec_as_array.c
..._MAXULONG, 8 * 1024 * 1024, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); /** * SwfdecAsContext::trace: diff --cc libswfdec/swfdec_as_interpret.c index 461c875,4a712c2..d08b00a @@@ -1541,7 -1554,8 +1542,8 @@@ } if (name == NULL) name = "unnamed_function"; - script = swfdec_script_new (&bits, name, cx->version); + script = swfdec_script_new_from_bits (&bits, name, cx->version); + swfdec_buffer_unref (buffer); if (script == NULL) { SWFDEC_ERROR ("failed to create script"); g_free (args); diff --cc libswfdec/swfdec_as_object.c index 111d...
2007 Mar 29
0
Branch 'as' - 9 commits - libswfdec-gtk/swfdec_playback_alsa.c libswfdec/js libswfdec/Makefile.am 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
...+ guint version; /* version of the script */ ++ guint n_registers; /* number of registers */ gpointer debugger; /* debugger owning us or NULL */ /* needed by functions */ SwfdecBuffer * constant_pool; /* constant pool action */ @@@ -73,15 -73,14 +73,15 @@@ SwfdecScript * swfdec_script_new (SwfdecBits * bits, const char * name, - unsigned int version); - guint version); ++ guint version); SwfdecScript * swfdec_script_new_for_player (SwfdecPlayer * player, SwfdecBits * bits, const char * name, - unsigned i...
2007 Feb 13
0
9 commits - libswfdec/js libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_codec_screen.c libswfdec/swfdec_image.c libswfdec/swfdec_script.c test/Makefile.am test/swfdec_out.c test/swfdec_out.h test/swfedit.c test/swfedit_file.c
...ut, gconstpointer hint) { SwfdecScript *script = data; @@ -210,14 +211,42 @@ swfedit_script_write (gpointer data, Swf } static gpointer -swfedit_script_read (SwfdecBits *bits, gconstpointer hint) +swfedit_script_read (SwfeditToken *token, SwfdecBits *bits, gconstpointer hint) { - return swfdec_script_new (bits, "original script", 6 /* FIXME */); + while (token->parent) + token = token->parent; + if (!SWFEDIT_IS_FILE (token)) + return NULL; + return swfdec_script_new (bits, "original script", swfedit_file_get_version (SWFEDIT_FILE (token))); +} + +static void +swfe...
2007 Mar 29
0
libswfdec-gtk/swfdec_playback_alsa.c libswfdec/swfdec_audio_event.h libswfdec/swfdec_audio_flv.h libswfdec/swfdec_audio_stream.h libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_cache.c
...SWFDEC_LOG ("exporting %u assets", count); diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index a9f16e0..0aff14c 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -2699,7 +2699,7 @@ validate_action (gconstpointer bytecode, SwfdecScript * swfdec_script_new_for_player (SwfdecPlayer *player, SwfdecBits *bits, - const char *name, unsigned int version) + const char *name, guint version) { SwfdecScript *script; @@ -2713,7 +2713,7 @@ swfdec_script_new_for_player (SwfdecPlay } SwfdecScript * -swfdec_script_new (SwfdecBits *bits, const char...
2007 Aug 13
0
Branch 'vivi' - 24 commits - configure.ac libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_tag.c libswfdec/swfdec_tag.h vivified/core vivified/dock vivified/ui
...ion, &len); - if (data == NULL || len == 0) { + if (data == NULL || len <= 1) { if (error) *error = vivi_ming_get_error (); - return NULL; + script = NULL; + } else { + buffer = swfdec_buffer_new_and_alloc (len); + memcpy (buffer->data, data, len); + script = swfdec_script_new (buffer, "compiled script", 8); } - buffer = swfdec_buffer_new_and_alloc (len); - memcpy (buffer->data, data, len); - script = swfdec_script_new (buffer, "compiled script", 8); + vivi_ming_clear_error (); return script; } diff-tree a56f1d2fe63954590ae4f0299af004c...
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
...truct _SwfdecScript { char * name; /* name identifying this script */ unsigned int version; /* version of the script */ gpointer debugger; /* debugger owning us or NULL */ + /* needed by functions */ + SwfdecBuffer * constant_pool; /* constant pool action */ }; SwfdecScript * swfdec_script_new (SwfdecBits * bits,
2007 Mar 28
0
Branch 'as' - 3 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_types.c
..._next_frame, swfdec_action_next_frame, swfdec_action_next_frame } }, [0x05] = { "PreviousFrame", NULL, 0, 0, { swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame, swfdec_action_previous_frame } }, @@ -2731,6 +2741,8 @@ swfdec_script_new (SwfdecBits *bits, con script->refcount = 1; script->name = g_strdup (name ? name : "Unnamed script"); script->version = version; + /* by default, a function has 4 registers */ + script->n_registers = 5; /* These flags are the default arguments used by scripts re...
2007 Aug 20
0
15 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_super.c libswfdec/swfdec_as_with.c
...ze) { SWFDEC_ERROR ("size of function is too big"); g_free (args); + g_free (function_name); return; } /* create the script */ @@ -1554,9 +1555,11 @@ swfdec_action_define_function (SwfdecAsC if (name == NULL) name = "unnamed_function"; script = swfdec_script_new (&bits, name, cx->version); + swfdec_buffer_unref (buffer); if (script == NULL) { SWFDEC_ERROR ("failed to create script"); g_free (args); + g_free (function_name); return; } if (frame->constant_pool_buffer) @@ -1574,13 +1577,14 @@ swfdec_action_defin...
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, + actions[action].name ? actions[action].name : "Unknown"); + return FALSE; + } /* we might want to do stuff here for certain actions */ -#if 0 +#if 1 { char *foo = swfdec_script_print_action (action, data, len); if (foo == NULL) @@ -361,7 +624,7 @@ SwfdecScript * swfdec_script_new (SwfdecBits *bits, const char *name, unsigned int version) { SwfdecScript *script; - guchar *start; + const guchar *start; g_return_val_if_fail (bits != NULL, NULL); if (version < MINSCRIPTVERSION) { @@ -442,7 +705,7 @@ swfdec_script_interpret (SwfdecScript *s /* set up ge...
2008 Jan 08
0
4 commits - configure.ac test/compiler.c test/.gitignore test/Makefile.am test/swfdec_test.c test/swfdec_test_function.c test/swfdec_test_function.h test/swfdec_test_global.c test/swfdec_test_initialize.as test/swfdec_test_initialize.h
...t ("ERROR: %s is not a Swfdec test script\n", filename); + swfdec_buffer_unref (file); + return NULL; + } + buffer = swfdec_buffer_new_subbuffer (file, sizeof (SWFDEC_TEST_FILE_ID), + file->length - sizeof (SWFDEC_TEST_FILE_ID)); + swfdec_buffer_unref (file); + script = swfdec_script_new (buffer, "main", SWFDEC_TEST_VERSION); + return script; +} + +int +main (int argc, char **argv) +{ + char *script_filename = NULL; + GError *error = NULL; + SwfdecAsContext *context; + SwfdecAsObject *array; + SwfdecScript *script; + SwfdecAsValue val; + int i, ret; + + GOptionEn...
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
...truct _SwfdecScript { char * name; /* name identifying this script */ unsigned int version; /* version of the script */ gpointer debugger; /* debugger owning us or NULL */ + /* needed by functions */ + SwfdecBuffer * constant_pool; /* constant pool action */ }; SwfdecScript * swfdec_script_new (SwfdecBits * bits, diff-tree ae64862c94f18618313c90c28b4071d84693b7b5 (from 71b090ccdeedb1e96b2f8590844844139b00bd85) Author: Benjamin Otte <otte@gnome.org> Date: Wed Jan 31 21:35:50 2007 +0100 implement BitAnd, BitOr, BitXor, DefineLocal, DefineLocal2 and Return diff --git a/libsw...
2007 Mar 29
0
Branch 'as' - 9 commits - configure.ac doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_stack.c
...Make swfdec_script_ref return the ref'ed script This matches all the other refcounting functions diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 6b7477e..a6e8312 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -2759,12 +2759,14 @@ swfdec_script_new (SwfdecBits *bits, con return script; } -void +SwfdecScript * swfdec_script_ref (SwfdecScript *script) { - g_return_if_fail (script != NULL); + g_return_val_if_fail (script != NULL, NULL); + g_return_val_if_fail (script->refcount > 0, NULL); script->refcount++; + return sc...
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
...since + * it will contain the name this function will soon be assigned to. + */ + if (JSVAL_IS_STRING (cx->fp->sp[-1])) + name = JS_GetStringBytes (JSVAL_TO_STRING (cx->fp->sp[-1])); + } + if (name == NULL) + name = "unnamed_function"; + script = swfdec_script_new (&bits, name, ((SwfdecScript *) cx->fp->swf)->version); + swfdec_buffer_unref (buffer); + } + if (script == NULL) { + SWFDEC_ERROR ("failed to create script"); + g_free (preloads); + return JS_FALSE; + } + if (cx->fp->constant_pool) { + script->con...