[Swfdec] 3 commits - doc/Makefile.am doc/swfdec-docs.sgml doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_array.c libswfdec/swfdec_as_boolean.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_frame_internal.h 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 libswfdec/swfdec_as_script_function.c libswfdec/swfdec_as_stack.c libswfdec/swfdec_as_string.c libswfdec/swfdec_as_super.c libswfdec/swfdec_as_with.c libswfdec/swfdec_debugger.c libswfdec/swfdec.h libswfdec/swfdec_net_stream_as.c

Benjamin Otte company at kemper.freedesktop.org
Fri Jul 13 09:11:01 PDT 2007


 doc/Makefile.am                       |    1 
 doc/swfdec-docs.sgml                  |    1 
 doc/swfdec-sections.txt               |   23 ++++++++
 libswfdec/Makefile.am                 |    3 -
 libswfdec/swfdec.h                    |    9 +--
 libswfdec/swfdec_as_array.c           |    2 
 libswfdec/swfdec_as_boolean.c         |    3 -
 libswfdec/swfdec_as_context.c         |   46 ++++++++++++++++-
 libswfdec/swfdec_as_context.h         |    3 +
 libswfdec/swfdec_as_frame.c           |   73 +++++++++++++++++++++++++++
 libswfdec/swfdec_as_frame.h           |   56 +-------------------
 libswfdec/swfdec_as_frame_internal.h  |   91 ++++++++++++++++++++++++++++++++++
 libswfdec/swfdec_as_function.c        |    2 
 libswfdec/swfdec_as_interpret.c       |    2 
 libswfdec/swfdec_as_native_function.c |    2 
 libswfdec/swfdec_as_number.c          |    2 
 libswfdec/swfdec_as_object.c          |    2 
 libswfdec/swfdec_as_script_function.c |    2 
 libswfdec/swfdec_as_stack.c           |    2 
 libswfdec/swfdec_as_string.c          |    3 -
 libswfdec/swfdec_as_super.c           |    2 
 libswfdec/swfdec_as_with.c            |    2 
 libswfdec/swfdec_debugger.c           |    2 
 libswfdec/swfdec_net_stream_as.c      |    3 -
 24 files changed, 261 insertions(+), 76 deletions(-)

New commits:
diff-tree 9c97866d31aa8b014aac79b676ef36492ef39888 (from 1c102df1c302267b3429ad6046a0eab77ffa8c0d)
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jul 13 18:10:44 2007 +0200

    really install swfdec_as_frame.h and document it
    
    Woohoo, everything documented!

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index 1e06a10..500c431 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -121,6 +121,7 @@ libswfdec_ at SWFDEC_MAJORMINOR@_la_LDFLAGS
 public_headers = \
 	swfdec.h \
 	swfdec_as_context.h \
+	swfdec_as_frame.h \
 	swfdec_as_object.h \
 	swfdec_as_types.h \
 	swfdec_audio.h \
@@ -135,7 +136,7 @@ libswfdec_ at SWFDEC_MAJORMINOR@include_HEA
 noinst_HEADERS = \
 	swfdec_as_array.h \
 	swfdec_as_boolean.h \
-	swfdec_as_frame.h \
+	swfdec_as_frame_internal.h \
 	swfdec_as_function.h \
 	swfdec_as_internal.h \
 	swfdec_as_interpret.h \
diff --git a/libswfdec/swfdec.h b/libswfdec/swfdec.h
index 6af4d0a..3d326db 100644
--- a/libswfdec/swfdec.h
+++ b/libswfdec/swfdec.h
@@ -22,14 +22,15 @@
 #ifndef __SWFDEC_H__
 #define __SWFDEC_H__
 
+#include <libswfdec/swfdec_as_context.h>
+#include <libswfdec/swfdec_as_frame.h>
+#include <libswfdec/swfdec_as_object.h>
+#include <libswfdec/swfdec_as_types.h>
+
 #include <libswfdec/swfdec_audio.h>
 #include <libswfdec/swfdec_buffer.h>
 #include <libswfdec/swfdec_enums.h>
 #include <libswfdec/swfdec_loader.h>
 #include <libswfdec/swfdec_player.h>
 
-#include <libswfdec/swfdec_as_context.h>
-#include <libswfdec/swfdec_as_object.h>
-#include <libswfdec/swfdec_as_types.h>
-
 #endif
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 109b4ab..ede2858 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -30,8 +30,38 @@
 #include "swfdec_as_super.h"
 #include "swfdec_debug.h"
 
+/**
+ * SECTION:SwfdecAsFrame
+ * @title: SwfdecAsFrame
+ * @short_description: information about currently executing frames
+ *
+ * This section is only interesting for people that want to look into debugging.
+ * A SwfdecAsFrame describes a currently executing function while it is
+ * running. On every new function call, a new frame is created and pushed on top
+ * of the frame stack. To get the topmost one, use 
+ * swfdec_as_context_get_frame(). After that you can inspect various properties
+ * of the frame, like the current stack.
+ *
+ * a #SwfdecAsFrame is a #SwfdecAsObject, so it is possible to set variables on
+ * it. These are local variables inside the executing function. So you can use
+ * functions such as swfdec_as_object_get_variable() to inspect them.
+ */
+
+/**
+ * SwfdecAsFrame:
+ *
+ * the object used to represent an executing function.
+ */
+
 /*** STACK ITERATOR ***/
 
+/**
+ * SwfdecAsStackIterator:
+ *
+ * This is a struct used to walk the stack of a frame. It is supposed to be 
+ * allocated on the stack. All of its members are private.
+ */
+
 SwfdecAsValue *
 swfdec_as_stack_iterator_init_arguments (SwfdecAsStackIterator *iter, SwfdecAsFrame *frame)
 {
@@ -57,6 +87,23 @@ swfdec_as_stack_iterator_init_arguments 
   return iter->current;
 }
 
+/**
+ * swfdec_as_stack_iterator_init:
+ * @iter: a #SwfdecStackIterator
+ * @frame: the frame to initialize from
+ *
+ * Initializes @iter to walk the stack of @frame. The first value on the stack
+ * will alread be returned. This makes it possible to write a simple loop to 
+ * print the whole stack:
+ * |[for (value = swfdec_as_stack_iterator_init (&iter, frame); value != NULL;
+ *     value = swfdec_as_stack_iterator_next (&iter)) {
+ *   char *s = swfdec_as_value_to_debug (value);
+ *   g_print ("%s\n", s);
+ *   g_free (s);
+ * }]|
+ *
+ * Returns: the topmost value on the stack of @frame or %NULL if none
+ **/
 SwfdecAsValue *
 swfdec_as_stack_iterator_init (SwfdecAsStackIterator *iter, SwfdecAsFrame *frame)
 {
@@ -102,6 +149,14 @@ swfdec_as_stack_iterator_init (SwfdecAsS
   return iter->current;
 }
 
+/**
+ * swfdec_as_stack_iterator_next:
+ * @iter: a #SwfdecAsStackIterator
+ *
+ * Gets the next value on the stack.
+ *
+ * Returns: The next value on the stack or %NULL if no more values are on the stack
+ **/
 SwfdecAsValue *
 swfdec_as_stack_iterator_next (SwfdecAsStackIterator *iter)
 {
diff-tree 1c102df1c302267b3429ad6046a0eab77ffa8c0d (from cafba89fb84a393328a6610f0f07c332074b572e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jul 13 17:50:40 2007 +0200

    add the rest of the documentation
    
    yay, no more unused symbols

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 03bc0da..f88b306 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -56,6 +56,7 @@ IGNORE_HFILES= \
 	jpeg \
 	swfdec_amf.h \
 	swfdec_as_boolean.h \
+	swfdec_as_frame_internal.h \
 	swfdec_as_internal.h \
 	swfdec_as_interpret.h \
 	swfdec_as_math.h \
diff --git a/doc/swfdec-docs.sgml b/doc/swfdec-docs.sgml
index 553dfb1..e04ade0 100644
--- a/doc/swfdec-docs.sgml
+++ b/doc/swfdec-docs.sgml
@@ -28,5 +28,6 @@
     <xi:include href="xml/SwfdecAsObject.xml"/>
     <xi:include href="xml/SwfdecAsArray.xml"/>
     <xi:include href="xml/SwfdecAsFunction.xml"/>
+    <xi:include href="xml/SwfdecAsFrame.xml"/>
   </chapter>
 </book>
diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index 7773b37..9c0f01c 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -235,6 +235,8 @@ swfdec_as_context_unuse_mem
 swfdec_as_context_eval
 swfdec_as_context_eval_set
 swfdec_as_context_get_time
+swfdec_as_context_get_frame
+swfdec_as_context_is_constructing
 <SUBSECTION Standard>
 swfdec_as_context_get_type
 SwfdecAsContextClass
@@ -328,3 +330,24 @@ SWFDEC_IS_AS_NATIVE_FUNCTION
 SWFDEC_IS_AS_NATIVE_FUNCTION_CLASS
 SWFDEC_TYPE_AS_NATIVE_FUNCTION
 </SECTION>
+
+<SECTION>
+<FILE>SwfdecAsFrame</FILE>
+<TITLE>SwfdecAsFrame</TITLE>
+SwfdecAsFrame
+swfdec_as_frame_get_next
+SwfdecAsStackIterator
+swfdec_as_stack_iterator_init
+swfdec_as_stack_iterator_next
+<SUBSECTION Standard>
+swfdec_as_frame_get_type
+SwfdecAsScope
+SwfdecAsStack
+SwfdecAsFrameClass
+SWFDEC_AS_FRAME
+SWFDEC_AS_FRAME_CLASS
+SWFDEC_AS_FRAME_GET_CLASS
+SWFDEC_IS_AS_FRAME
+SWFDEC_IS_AS_FRAME_CLASS
+SWFDEC_TYPE_AS_FRAME
+</SECTION>
diff-tree cafba89fb84a393328a6610f0f07c332074b572e (from 420ca51e53e5a2a9d23ea36be541b04ab434ca6e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jul 13 17:47:21 2007 +0200

    prepare swfdec_as_frame.h for export
    
    This includes moving various functions into the new internal header and
    adding API to access the current frames

diff --git a/libswfdec/swfdec_as_array.c b/libswfdec/swfdec_as_array.c
index c37d224..32760a3 100644
--- a/libswfdec/swfdec_as_array.c
+++ b/libswfdec/swfdec_as_array.c
@@ -27,7 +27,7 @@
 
 #include "swfdec_as_array.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_function.h"
 #include "swfdec_as_internal.h"
 #include "swfdec_as_native_function.h"
diff --git a/libswfdec/swfdec_as_boolean.c b/libswfdec/swfdec_as_boolean.c
index da45473..907960a 100644
--- a/libswfdec/swfdec_as_boolean.c
+++ b/libswfdec/swfdec_as_boolean.c
@@ -25,7 +25,6 @@
 
 #include "swfdec_as_boolean.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
@@ -56,7 +55,7 @@ swfdec_as_boolean_construct (SwfdecAsCon
     b = FALSE;
   }
 
-  if (cx->frame->construct) {
+  if (swfdec_as_context_is_constructing (cx)) {
     SWFDEC_AS_BOOLEAN (object)->boolean = b;
     SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
   } else {
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 8a5c20d..227444e 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -26,7 +26,7 @@
 #include "swfdec_as_context.h"
 #include "swfdec_as_array.h"
 #include "swfdec_as_boolean.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_function.h"
 #include "swfdec_as_internal.h"
 #include "swfdec_as_interpret.h"
@@ -550,6 +550,50 @@ swfdec_as_context_give_string (SwfdecAsC
 }
 
 /**
+ * swfdec_as_context_is_constructing:
+ * @context: a #SwfdecAsConstruct
+ *
+ * Determines if the contexxt is currently constructing. This information is
+ * used by various constructors to do different things when they are 
+ * constructing and when they are not. The Boolean, Number and String functions
+ * for example setup the newly constructed objects when constructing but only
+ * cast the provided argument when being called.
+ *
+ * Returns: %TRUE if the currently executing frame is a constructor
+ **/
+gboolean
+swfdec_as_context_is_constructing (SwfdecAsContext *context)
+{
+  g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
+
+  return context->frame && context->frame->construct;
+}
+
+/**
+ * swfdec_as_context_get_frame:
+ * @context: a #SwfdecAsContext
+ *
+ * This is a debugging function. It gets the topmost stack frame that is 
+ * currently executing. If no function is executing, %NULL is returned. You can
+ * easily get a backtrace with code like this:
+ * |[for (frame = swfdec_as_context_get_frame (context); frame != NULL; 
+ *     frame = swfdec_as_frame_get_next (frame)) {
+ *   char *s = swfdec_as_object_get_debug (SWFDEC_AS_OBJECT (frame));
+ *   g_print ("%s\n", s);
+ *   g_free (s);
+ * }]|
+ *
+ * Returns: the currently executing frame or %NULL if none
+ **/
+SwfdecAsFrame *
+swfdec_as_context_get_frame (SwfdecAsContext *context)
+{
+  g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
+
+  return context->frame;
+}
+
+/**
  * swfdec_as_context_get_time:
  * @context: a #SwfdecAsContext
  * @tv: a #GTimeVal to be set to the context's time
diff --git a/libswfdec/swfdec_as_context.h b/libswfdec/swfdec_as_context.h
index 47b5453..d18fa62 100644
--- a/libswfdec/swfdec_as_context.h
+++ b/libswfdec/swfdec_as_context.h
@@ -95,6 +95,9 @@ GType		swfdec_as_context_get_type	(void)
 void		swfdec_as_context_startup     	(SwfdecAsContext *	context,
 						 guint			version);
 
+gboolean	swfdec_as_context_is_constructing
+						(SwfdecAsContext *	context);
+SwfdecAsFrame *	swfdec_as_context_get_frame	(SwfdecAsContext *	context);
 void		swfdec_as_context_get_time	(SwfdecAsContext *	context,
 						 GTimeVal *		tv);
 const char *	swfdec_as_context_get_string	(SwfdecAsContext *	context,
diff --git a/libswfdec/swfdec_as_frame.c b/libswfdec/swfdec_as_frame.c
index 653adba..109b4ab 100644
--- a/libswfdec/swfdec_as_frame.c
+++ b/libswfdec/swfdec_as_frame.c
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif
 
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_frame.h"
 #include "swfdec_as_array.h"
 #include "swfdec_as_context.h"
@@ -608,3 +609,20 @@ swfdec_as_frame_check_scope (SwfdecAsFra
   }
 }
 
+/**
+ * swfdec_as_frame_get_next:
+ * @frame: a #SwfdecAsFrame
+ *
+ * Gets the next frame in the frame stack. The next frame is the frame that
+ * will be executed after this @frame.
+ *
+ * Returns: the next #SwfdecAsFrame or %NULL if this is the bottommost frame.
+ **/
+SwfdecAsFrame *
+swfdec_as_frame_get_next (SwfdecAsFrame *frame)
+{
+  g_return_val_if_fail (SWFDEC_IS_AS_FRAME (frame), NULL);
+
+  return frame->next;
+}
+
diff --git a/libswfdec/swfdec_as_frame.h b/libswfdec/swfdec_as_frame.h
index 6a8197a..b5d632e 100644
--- a/libswfdec/swfdec_as_frame.h
+++ b/libswfdec/swfdec_as_frame.h
@@ -20,9 +20,7 @@
 #ifndef _SWFDEC_AS_FRAME_H_
 #define _SWFDEC_AS_FRAME_H_
 
-#include <libswfdec/swfdec_as_scope.h>
 #include <libswfdec/swfdec_as_types.h>
-#include <libswfdec/swfdec_script.h>
 
 G_BEGIN_DECLS
 
@@ -45,62 +43,14 @@ struct _SwfdecAsStackIterator {
 #define SWFDEC_AS_FRAME_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_FRAME, SwfdecAsFrameClass))
 #define SWFDEC_AS_FRAME_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_FRAME, SwfdecAsFrameClass))
 
-struct _SwfdecAsFrame {
-  SwfdecAsScope		scope_object;
-
-  SwfdecAsFrame *	next;		/* next frame (FIXME: keep a list in the context instead?) */
-  SwfdecAsFunction *	function;	/* function we're executing or NULL if toplevel */
-  SwfdecAsObject *	thisp;		/* this object in current frame or NULL if none */
-  SwfdecAsObject *	super;		/* super object in current frame or NULL if none */
-  gboolean		construct;	/* TRUE if this is the constructor for thisp */
-  SwfdecAsValue *	return_value;	/* pointer to where to store the return value */
-  guint			argc;		/* number of arguments */
-  const SwfdecAsValue *	argv;		/* arguments or %NULL if taken from stack */
-  /* debugging */
-  char *		function_name;	/* name of function */
-  /* script execution */
-  SwfdecScript *	script;		/* script being executed */
-  SwfdecAsScope *	scope;		/* first object in scope chain (either this frame or a with object) */
-  SwfdecAsObject *	target;		/* target to use as last object in scope chain or for SetVariable */
-  SwfdecAsObject *	original_target;/* original target (used when resetting target) */
-  gboolean		is_local;	/* TRUE if this frame takes local variables */
-  SwfdecAsValue *	registers;	/* the registers */
-  guint			n_registers;	/* number of allocated registers */
-  SwfdecConstantPool *	constant_pool;	/* constant pool currently in use */
-  SwfdecBuffer *	constant_pool_buffer;	/* buffer containing the raw data for constant_pool */
-  SwfdecAsValue *	stack_begin;	/* beginning of stack */
-  guint8 *		pc;		/* program counter on stack */
-  /* native function */
-};
-
-struct _SwfdecAsFrameClass {
-  SwfdecAsScopeClass	scope_class;
-};
-
 GType		swfdec_as_frame_get_type	(void);
 
-SwfdecAsFrame *	swfdec_as_frame_new		(SwfdecAsContext *	context,
-						 SwfdecScript *		script);
-SwfdecAsFrame *	swfdec_as_frame_new_native	(SwfdecAsContext *	context);
-void		swfdec_as_frame_return		(SwfdecAsFrame *	frame,
-						 SwfdecAsValue *	return_value);
-
-void		swfdec_as_frame_set_this	(SwfdecAsFrame *	frame,
-						 SwfdecAsObject *	thisp);
-void		swfdec_as_frame_preload		(SwfdecAsFrame *	frame);
-
-SwfdecAsObject *swfdec_as_frame_find_variable	(SwfdecAsFrame *	frame,
-						 const char *		variable);
-gboolean	swfdec_as_frame_delete_variable	(SwfdecAsFrame *	frame,
-						 const char *		variable);
-
-void		swfdec_as_frame_set_target	(SwfdecAsFrame *	frame,
-						 SwfdecAsObject *	target);
-void		swfdec_as_frame_check_scope	(SwfdecAsFrame *	frame);
+SwfdecAsFrame *	swfdec_as_frame_get_next	(SwfdecAsFrame *		frame);
 
 SwfdecAsValue *	swfdec_as_stack_iterator_init	(SwfdecAsStackIterator *	iter,
-						 SwfdecAsFrame *	frame);
+						 SwfdecAsFrame *		frame);
 SwfdecAsValue *	swfdec_as_stack_iterator_next	(SwfdecAsStackIterator *	iter);
 
+
 G_END_DECLS
 #endif
diff --git a/libswfdec/swfdec_as_frame_internal.h b/libswfdec/swfdec_as_frame_internal.h
new file mode 100644
index 0000000..2a2a7cb
--- /dev/null
+++ b/libswfdec/swfdec_as_frame_internal.h
@@ -0,0 +1,91 @@
+/* Swfdec
+ * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifndef _SWFDEC_AS_FRAME_INTERNAL_H_
+#define _SWFDEC_AS_FRAME_INTERNAL_H_
+
+#include <libswfdec/swfdec_as_scope.h>
+#include <libswfdec/swfdec_as_types.h>
+#include <libswfdec/swfdec_script.h>
+
+G_BEGIN_DECLS
+
+#define SWFDEC_TYPE_AS_FRAME                    (swfdec_as_frame_get_type())
+#define SWFDEC_IS_AS_FRAME(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_FRAME))
+#define SWFDEC_IS_AS_FRAME_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_FRAME))
+#define SWFDEC_AS_FRAME(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_FRAME, SwfdecAsFrame))
+#define SWFDEC_AS_FRAME_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_FRAME, SwfdecAsFrameClass))
+#define SWFDEC_AS_FRAME_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_FRAME, SwfdecAsFrameClass))
+
+struct _SwfdecAsFrame {
+  SwfdecAsScope		scope_object;
+
+  SwfdecAsFrame *	next;		/* next frame (FIXME: keep a list in the context instead?) */
+  SwfdecAsFunction *	function;	/* function we're executing or NULL if toplevel */
+  SwfdecAsObject *	thisp;		/* this object in current frame or NULL if none */
+  SwfdecAsObject *	super;		/* super object in current frame or NULL if none */
+  gboolean		construct;	/* TRUE if this is the constructor for thisp */
+  SwfdecAsValue *	return_value;	/* pointer to where to store the return value */
+  guint			argc;		/* number of arguments */
+  const SwfdecAsValue *	argv;		/* arguments or %NULL if taken from stack */
+  /* debugging */
+  char *		function_name;	/* name of function */
+  /* script execution */
+  SwfdecScript *	script;		/* script being executed */
+  SwfdecAsScope *	scope;		/* first object in scope chain (either this frame or a with object) */
+  SwfdecAsObject *	target;		/* target to use as last object in scope chain or for SetVariable */
+  SwfdecAsObject *	original_target;/* original target (used when resetting target) */
+  gboolean		is_local;	/* TRUE if this frame takes local variables */
+  SwfdecAsValue *	registers;	/* the registers */
+  guint			n_registers;	/* number of allocated registers */
+  SwfdecConstantPool *	constant_pool;	/* constant pool currently in use */
+  SwfdecBuffer *	constant_pool_buffer;	/* buffer containing the raw data for constant_pool */
+  SwfdecAsValue *	stack_begin;	/* beginning of stack */
+  guint8 *		pc;		/* program counter on stack */
+  /* native function */
+};
+
+struct _SwfdecAsFrameClass {
+  SwfdecAsScopeClass	scope_class;
+};
+
+GType		swfdec_as_frame_get_type	(void);
+
+SwfdecAsFrame *	swfdec_as_frame_new		(SwfdecAsContext *	context,
+						 SwfdecScript *		script);
+SwfdecAsFrame *	swfdec_as_frame_new_native	(SwfdecAsContext *	context);
+void		swfdec_as_frame_return		(SwfdecAsFrame *	frame,
+						 SwfdecAsValue *	return_value);
+
+void		swfdec_as_frame_set_this	(SwfdecAsFrame *	frame,
+						 SwfdecAsObject *	thisp);
+void		swfdec_as_frame_preload		(SwfdecAsFrame *	frame);
+
+SwfdecAsObject *swfdec_as_frame_find_variable	(SwfdecAsFrame *	frame,
+						 const char *		variable);
+gboolean	swfdec_as_frame_delete_variable	(SwfdecAsFrame *	frame,
+						 const char *		variable);
+
+void		swfdec_as_frame_set_target	(SwfdecAsFrame *	frame,
+						 SwfdecAsObject *	target);
+void		swfdec_as_frame_check_scope	(SwfdecAsFrame *	frame);
+
+
+G_END_DECLS
+#endif
diff --git a/libswfdec/swfdec_as_function.c b/libswfdec/swfdec_as_function.c
index 466b9d3..aa5f8f3 100644
--- a/libswfdec/swfdec_as_function.c
+++ b/libswfdec/swfdec_as_function.c
@@ -23,7 +23,7 @@
 
 #include "swfdec_as_function.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_stack.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index d011028..53116cb 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -23,7 +23,7 @@
 #include "swfdec_as_interpret.h"
 #include "swfdec_as_array.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_function.h"
 #include "swfdec_as_script_function.h"
 #include "swfdec_as_stack.h"
diff --git a/libswfdec/swfdec_as_native_function.c b/libswfdec/swfdec_as_native_function.c
index b5b2f81..59cd182 100644
--- a/libswfdec/swfdec_as_native_function.c
+++ b/libswfdec/swfdec_as_native_function.c
@@ -23,7 +23,7 @@
 
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_stack.h"
 #include "swfdec_debug.h"
 
diff --git a/libswfdec/swfdec_as_number.c b/libswfdec/swfdec_as_number.c
index 632d25d..bc0b8cf 100644
--- a/libswfdec/swfdec_as_number.c
+++ b/libswfdec/swfdec_as_number.c
@@ -56,7 +56,7 @@ swfdec_as_number_construct (SwfdecAsCont
     d = NAN;
   }
 
-  if (cx->frame->construct) {
+  if (swfdec_as_context_is_constructing (cx)) {
     SwfdecAsNumber *num = SWFDEC_AS_NUMBER (object);
     num->number = d;
     SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 1284bea..0b8c848 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -25,7 +25,7 @@
 
 #include "swfdec_as_object.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_internal.h"
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_stack.h"
diff --git a/libswfdec/swfdec_as_script_function.c b/libswfdec/swfdec_as_script_function.c
index eff76b2..f8b6ad2 100644
--- a/libswfdec/swfdec_as_script_function.c
+++ b/libswfdec/swfdec_as_script_function.c
@@ -23,7 +23,7 @@
 
 #include "swfdec_as_script_function.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_stack.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
diff --git a/libswfdec/swfdec_as_stack.c b/libswfdec/swfdec_as_stack.c
index f9f69dd..f86e1e0 100644
--- a/libswfdec/swfdec_as_stack.c
+++ b/libswfdec/swfdec_as_stack.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include "swfdec_as_stack.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_debug.h"
 
 /* FIXME: make this configurable? */
diff --git a/libswfdec/swfdec_as_string.c b/libswfdec/swfdec_as_string.c
index c7babe3..f7c2da9 100644
--- a/libswfdec/swfdec_as_string.c
+++ b/libswfdec/swfdec_as_string.c
@@ -27,7 +27,6 @@
 #include "swfdec_as_string.h"
 #include "swfdec_as_array.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
@@ -218,7 +217,7 @@ swfdec_as_string_construct (SwfdecAsCont
     s = SWFDEC_AS_STR_EMPTY;
   }
 
-  if (cx->frame->construct) {
+  if (swfdec_as_context_is_constructing (cx)) {
     SwfdecAsString *string = SWFDEC_AS_STRING (object);
     SwfdecAsValue val;
 
diff --git a/libswfdec/swfdec_as_super.c b/libswfdec/swfdec_as_super.c
index e2eb652..f8cfe60 100644
--- a/libswfdec/swfdec_as_super.c
+++ b/libswfdec/swfdec_as_super.c
@@ -25,7 +25,7 @@
 
 #include "swfdec_as_super.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_function.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
diff --git a/libswfdec/swfdec_as_with.c b/libswfdec/swfdec_as_with.c
index 9fe0720..672d09d 100644
--- a/libswfdec/swfdec_as_with.c
+++ b/libswfdec/swfdec_as_with.c
@@ -23,7 +23,7 @@
 
 #include "swfdec_as_with.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_debug.h"
 
 G_DEFINE_TYPE (SwfdecAsWith, swfdec_as_with, SWFDEC_TYPE_AS_SCOPE)
diff --git a/libswfdec/swfdec_debugger.c b/libswfdec/swfdec_debugger.c
index 9b3120b..c7f9a35 100644
--- a/libswfdec/swfdec_debugger.c
+++ b/libswfdec/swfdec_debugger.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include "swfdec_debugger.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
+#include "swfdec_as_frame_internal.h"
 #include "swfdec_as_interpret.h"
 #include "swfdec_debug.h"
 #include "swfdec_decoder.h"
diff --git a/libswfdec/swfdec_net_stream_as.c b/libswfdec/swfdec_net_stream_as.c
index 8ce397e..839c549 100644
--- a/libswfdec/swfdec_net_stream_as.c
+++ b/libswfdec/swfdec_net_stream_as.c
@@ -23,7 +23,6 @@
 
 #include "swfdec_net_stream.h"
 #include "swfdec_as_context.h"
-#include "swfdec_as_frame.h"
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
@@ -81,7 +80,7 @@ swfdec_net_stream_construct (SwfdecAsCon
   SwfdecNetStream *stream = SWFDEC_NET_STREAM (obj);
   SwfdecNetConnection *conn;
   
-  if (!cx->frame->construct) {
+  if (!swfdec_as_context_is_constructing (cx)) {
     SWFDEC_FIXME ("What do we do if not constructing?");
     return;
   }


More information about the Swfdec mailing list