SwfdecAsDebugger

SwfdecAsDebugger — the debugger object see also: SwfdecAsContext

Synopsis


#include <swfdec/swfdec.h>

                    SwfdecAsDebugger;
                    SwfdecAsDebuggerClass;

                    SwfdecScript;
SwfdecScript*       swfdec_script_new                   (SwfdecBuffer *buffer,
                                                         const char *name,
                                                         guint version);
SwfdecScript*       swfdec_script_ref                   (SwfdecScript *script);
void                swfdec_script_unref                 (SwfdecScript *script);
guint               swfdec_script_get_version           (SwfdecScript *script);

Object Hierarchy

  GObject
   +----SwfdecAsDebugger

Description

The debugger object is a special object that can be set on a SwfdecAsContext upon creation. If that is done, the debugger can then be used to inspect the running Actionscript application.

Details

SwfdecAsDebugger

typedef struct _SwfdecAsDebugger SwfdecAsDebugger;

This is the type of the debugger object.


SwfdecAsDebuggerClass

typedef struct {
  /* a new object was added to the GC */
  void			(* add)		(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context,
					 SwfdecAsObject *	object);
  /* an object was removed from the GC */
  void			(* remove)    	(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context,
					 SwfdecAsObject *	object);
  /* called before executing a bytecode */
  void			(* step)	(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context);
  /* called after adding a frame from the function stack */
  void			(* enter_frame)	(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context,
					 SwfdecAsFrame *	frame);
  /* called after removing a frame from the function stack */
  void			(* leave_frame)	(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context,
					 SwfdecAsFrame *	frame,
					 const SwfdecAsValue *	return_value);
  /* called before setting a variable */
  void			(* set_variable)(SwfdecAsDebugger *	debugger,
					 SwfdecAsContext *	context,
					 SwfdecAsObject *	object,
					 const char *		variable,
					 const SwfdecAsValue *	value);
} SwfdecAsDebuggerClass;

The class object for the debugger. You need to override these functions to get useful functionality for the debugger.

add ()

Called whenever an object is added to the garbage collection engine using swfdec_as_object_add()

remove ()

Called whenever an object is about to be collected by the garbage collector.

step ()

This function is called everytime just before a bytecode is executed by the script engine. So it's very powerful, but can also slow down the script engine a lot.

enter_frame ()

Called after a new SwfdecAsFrame has been initialized and pushed to the top of the execution stack.

leave_frame ()

Called just after a SwfdecAsFrame has been removed from the execution stack. The return value has not been forwarded to the parent when this function is called.

set_variable ()

Called whenever swfdec_as_object_set_variable() is called, before actually setting the variable. This function is also called when variables are set by internal code, not just when interpreting scripts. It also doesn't matter if setting the variable will succeed.

SwfdecScript

typedef struct _SwfdecScript SwfdecScript;

This is the object used for code to be executed by Swfdec. Scripts are independant from the SwfdecAsContext they are executed in, so you can execute the same script in multiple contexts.


swfdec_script_new ()

SwfdecScript*       swfdec_script_new                   (SwfdecBuffer *buffer,
                                                         const char *name,
                                                         guint version);

Creates a new script for the actionscript provided in buffer.

buffer :

the SwfdecBuffer containing the script. This function will take ownership of the passed in buffer.

name :

name of the script for debugging purposes

version :

Actionscript version to use in this script

Returns :

a new SwfdecScript for executing the script in buffer.

swfdec_script_ref ()

SwfdecScript*       swfdec_script_ref                   (SwfdecScript *script);

Increases the reference count of the given script by one.

script :

a script

Returns :

The script given as an argument

swfdec_script_unref ()

void                swfdec_script_unref                 (SwfdecScript *script);

Decreases the reference count of the given script by one. If the count reaches zero, it will automatically be destroyed.

script :

a script

swfdec_script_get_version ()

guint               swfdec_script_get_version           (SwfdecScript *script);

Queries the Flash version this script was compiled with. Different versions result in slightly different behavior in the script interpreter.

script :

the script

Returns :

The Flash version this script conforms to