2 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_SCRIPT_INTERNAL_H_
21 #define _SWFDEC_SCRIPT_INTERNAL_H_
23 #include <swfdec/swfdec.h>
24 #include <swfdec/swfdec_as_types.h>
25 #include <swfdec/swfdec_types.h>
26 #include <swfdec/swfdec_bits.h>
27 #include <swfdec/swfdec_constant_pool.h>
31 typedef struct _SwfdecScriptArgument SwfdecScriptArgument
;
34 SWFDEC_SCRIPT_PRELOAD_THIS
= (1 << 0),
35 SWFDEC_SCRIPT_SUPPRESS_THIS
= (1 << 1),
36 SWFDEC_SCRIPT_PRELOAD_ARGS
= (1 << 2),
37 SWFDEC_SCRIPT_SUPPRESS_ARGS
= (1 << 3),
38 SWFDEC_SCRIPT_PRELOAD_SUPER
= (1 << 4),
39 SWFDEC_SCRIPT_SUPPRESS_SUPER
= (1 << 5),
40 SWFDEC_SCRIPT_PRELOAD_ROOT
= (1 << 6),
41 SWFDEC_SCRIPT_PRELOAD_PARENT
= (1 << 7),
42 SWFDEC_SCRIPT_PRELOAD_GLOBAL
= (1 << 8)
45 typedef gboolean (* SwfdecScriptForeachFunc
) (gconstpointer bytecode
, guint action
,
46 const guint8
*data
, guint len
, gpointer user_data
);
48 /* FIXME: May want to typedef to SwfdecBuffer directly */
49 struct _SwfdecScript
{
50 SwfdecBuffer
* buffer
; /* buffer holding the script */
51 const guint8
* main
; /* entry point for script */
52 const guint8
* exit
; /* exit point for script */
53 guint refcount
; /* reference count */
54 char * name
; /* name identifying this script */
55 guint version
; /* version of the script */
56 guint n_registers
; /* number of registers */
57 SwfdecBuffer
* constant_pool
; /* constant pool action */
58 guint flags
; /* SwfdecScriptFlags */
59 guint n_arguments
; /* number of arguments */
60 SwfdecScriptArgument
*arguments
; /* arguments or NULL if none */
63 struct _SwfdecScriptArgument
{
64 char * name
; /* name of the argument (not GC'ed) */
65 guint preload
; /* preload slot to preload to or 0 */
68 const char * swfdec_action_get_name (guint action
);
69 guint
swfdec_action_get_from_name (const char * name
);
71 SwfdecScript
* swfdec_script_new_from_bits (SwfdecBits
* bits
,
75 gboolean
swfdec_script_foreach (SwfdecScript
* script
,
76 SwfdecScriptForeachFunc func
,