back to development
[swfdec.git] / swfdec / swfdec_as_frame_internal.h
blob61c09e9c019b3a8c247ad069e103bfe7f65469e6
1 /* Swfdec
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.
8 *
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_types.h>
24 #include <swfdec/swfdec_script_internal.h>
26 G_BEGIN_DECLS
28 typedef void (* SwfdecAsFrameBlockFunc) (SwfdecAsContext *cx, SwfdecAsFrame *frame, gpointer data);
30 struct _SwfdecAsFrame {
31 SwfdecAsFrame * next; /* next frame (FIXME: keep a list in the context instead?) */
32 SwfdecAsFunction * function; /* function we're executing or NULL if toplevel */
33 SwfdecAsObject * thisp; /* this object in current frame or NULL if none */
34 SwfdecAsObject * super; /* super object in current frame or NULL if none */
35 gboolean construct; /* TRUE if this is the constructor for thisp */
36 SwfdecAsValue * return_value; /* pointer to where to store the return value */
37 guint argc; /* number of arguments */
38 const SwfdecAsValue * argv; /* arguments or %NULL if taken from stack */
39 /* script execution */
40 SwfdecScript * script; /* script being executed */
41 GSList * scope_chain; /* the scope chain (with objects etc) */
42 const guint8 * block_start; /* start of current block */
43 const guint8 * block_end; /* end of current block */
44 GArray * blocks; /* blocks we have entered (like With) */
45 SwfdecAsObject * target; /* target to use as last object in scope chain or for SetVariable */
46 SwfdecAsObject * original_target;/* original target (used when resetting target) */
47 SwfdecAsObject * activation; /* activation object or NULL if the frame takes no local variables */
48 SwfdecAsValue * registers; /* the registers */
49 guint n_registers; /* number of allocated registers */
50 SwfdecConstantPool * constant_pool; /* constant pool currently in use */
51 SwfdecAsValue * stack_begin; /* beginning of stack */
52 const guint8 * pc; /* program counter on stack */
53 /* native function */
56 void swfdec_as_frame_init (SwfdecAsFrame * frame,
57 SwfdecAsContext * context,
58 SwfdecScript * script);
59 void swfdec_as_frame_init_native (SwfdecAsFrame * frame,
60 SwfdecAsContext * context);
61 void swfdec_as_frame_return (SwfdecAsFrame * frame,
62 SwfdecAsValue * return_value);
64 void swfdec_as_frame_set_this (SwfdecAsFrame * frame,
65 SwfdecAsObject * thisp);
66 void swfdec_as_frame_preload (SwfdecAsFrame * frame);
68 #define swfdec_as_frame_get_variable(frame, variable, value) \
69 swfdec_as_frame_get_variable_and_flags (frame, variable, value, NULL, NULL)
70 SwfdecAsObject *swfdec_as_frame_get_variable_and_flags
71 (SwfdecAsFrame * frame,
72 const char * variable,
73 SwfdecAsValue * value,
74 guint * flags,
75 SwfdecAsObject ** pobject);
76 #define swfdec_as_frame_set_variable(frame, variable, value, overwrite, local) \
77 swfdec_as_frame_set_variable_and_flags (frame, variable, value, 0, overwrite, local)
78 void swfdec_as_frame_set_variable_and_flags
79 (SwfdecAsFrame * frame,
80 const char * variable,
81 const SwfdecAsValue * value,
82 guint default_flags,
83 gboolean overwrite,
84 gboolean local);
85 SwfdecAsDeleteReturn
86 swfdec_as_frame_delete_variable (SwfdecAsFrame * frame,
87 const char * variable);
89 void swfdec_as_frame_set_target (SwfdecAsFrame * frame,
90 SwfdecAsObject * target);
91 void swfdec_as_frame_push_block (SwfdecAsFrame * frame,
92 const guint8 * start,
93 const guint8 * end,
94 SwfdecAsFrameBlockFunc func,
95 gpointer data);
96 void swfdec_as_frame_pop_block (SwfdecAsFrame * frame,
97 SwfdecAsContext * context);
98 void swfdec_as_frame_handle_exception(SwfdecAsFrame * frame);
101 G_END_DECLS
102 #endif