2 * Copyright (C) 2007-2008 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_AS_FRAME_INTERNAL_H_
21 #define _SWFDEC_AS_FRAME_INTERNAL_H_
23 #include <swfdec/swfdec_as_super.h>
24 #include <swfdec/swfdec_as_types.h>
25 #include <swfdec/swfdec_script_internal.h>
26 #include <swfdec/swfdec_types.h>
30 typedef void (* SwfdecAsFrameBlockFunc
) (SwfdecAsContext
*cx
, SwfdecAsFrame
*frame
, gpointer data
);
32 struct _SwfdecAsFrame
{
33 SwfdecAsFrame
* next
; /* next frame (FIXME: keep a list in the context instead?) */
34 SwfdecAsFunction
* function
; /* function we're executing or NULL if toplevel */
35 SwfdecAsValue thisp
; /* this object in current frame or undefined if none */
36 SwfdecAsSuper
* super
; /* super object in current frame or NULL if none */
37 gboolean construct
; /* TRUE if this is the constructor for thisp */
38 SwfdecAsValue
* return_value
; /* pointer to where to store the return value */
39 guint argc
; /* number of arguments */
40 const SwfdecAsValue
* argv
; /* arguments or %NULL if taken from stack */
41 /* script execution */
42 SwfdecScript
* script
; /* script being executed */
43 GSList
* scope_chain
; /* the scope chain (with objects etc) */
44 const guint8
* block_start
; /* start of current block */
45 const guint8
* block_end
; /* end of current block */
46 GArray
* blocks
; /* blocks we have entered (like With) */
47 SwfdecMovie
* target
; /* target to use as last object in scope chain or for SetVariable */
48 SwfdecMovie
* original_target
;/* original target (used when resetting target) */
49 SwfdecAsObject
* activation
; /* activation object or NULL if the frame takes no local variables */
50 SwfdecAsValue
* registers
; /* the registers */
51 guint n_registers
; /* number of allocated registers */
52 SwfdecConstantPool
* constant_pool
; /* constant pool currently in use */
53 SwfdecAsValue
* stack_begin
; /* beginning of stack */
54 const guint8
* pc
; /* program counter on stack */
58 void swfdec_as_frame_init (SwfdecAsFrame
* frame
,
59 SwfdecAsContext
* context
,
60 SwfdecScript
* script
);
61 void swfdec_as_frame_init_native (SwfdecAsFrame
* frame
,
62 SwfdecAsContext
* context
);
63 void swfdec_as_frame_free (SwfdecAsContext
* context
,
64 SwfdecAsFrame
* frame
);
66 void swfdec_as_frame_set_this (SwfdecAsFrame
* frame
,
67 SwfdecAsObject
* thisp
);
68 void swfdec_as_frame_preload (SwfdecAsContext
* context
,
69 SwfdecAsFrame
* frame
);
71 #define swfdec_as_frame_get_variable(cx, frame, variable, value) \
72 swfdec_as_frame_get_variable_and_flags (cx, frame, variable, value, NULL, NULL)
73 SwfdecAsObject
*swfdec_as_frame_get_variable_and_flags
74 (SwfdecAsContext
* context
,
75 SwfdecAsFrame
* frame
,
76 const char * variable
,
77 SwfdecAsValue
* value
,
79 SwfdecAsObject
** pobject
);
80 #define swfdec_as_frame_set_variable(cx, frame, variable, value, overwrite, local) \
81 swfdec_as_frame_set_variable_and_flags (cx, frame, variable, value, 0, overwrite, local)
82 void swfdec_as_frame_set_variable_and_flags
83 (SwfdecAsContext
* context
,
84 SwfdecAsFrame
* frame
,
85 const char * variable
,
86 const SwfdecAsValue
* value
,
91 swfdec_as_frame_delete_variable (SwfdecAsContext
* context
,
92 SwfdecAsFrame
* frame
,
93 const char * variable
);
95 void swfdec_as_frame_set_target (SwfdecAsFrame
* frame
,
96 SwfdecMovie
* target
);
97 void swfdec_as_frame_push_block (SwfdecAsFrame
* frame
,
100 SwfdecAsFrameBlockFunc func
,
102 void swfdec_as_frame_pop_block (SwfdecAsFrame
* frame
,
103 SwfdecAsContext
* context
);
104 void swfdec_as_frame_handle_exception(SwfdecAsContext
* context
,
105 SwfdecAsFrame
* frame
);
106 SwfdecMovie
* swfdec_as_frame_get_target (SwfdecAsFrame
* frame
);