## SwfdecAsFrame SwfdecAsFrame — information about currently executing frames |

## Synopsis

    #include <swfdec/swfdec.h>

                        SwfdecAsFrame;
    SwfdecAsFrame*      swfdec_as_frame_get_next            (SwfdecAsFrame *frame);
    SwfdecScript*       swfdec_as_frame_get_script          (SwfdecAsFrame *frame);
    SwfdecAsObject*     swfdec_as_frame_get_this            (SwfdecAsFrame *frame);
                        SwfdecAsStackIterator;
    SwfdecAsValue*      swfdec_as_stack_iterator_init       (SwfdecAsStackIterator *iter,
                                                             SwfdecAsFrame *frame);
    SwfdecAsValue*      swfdec_as_stack_iterator_init_arguments
                                                            (SwfdecAsStackIterator *iter,
                                                             SwfdecAsFrame *frame);
    SwfdecAsValue*      swfdec_as_stack_iterator_next       (SwfdecAsStackIterator *iter);

## Description

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.

## Details

### SwfdecAsFrame

    typedef struct _SwfdecAsFrame SwfdecAsFrame;

the object used to represent an executing function.

### swfdec_as_frame_get_next ()

    SwfdecAsFrame*      swfdec_as_frame_get_next            (SwfdecAsFrame *frame);

Gets the next frame in the frame stack. The next frame is the frame that will be executed after this `frame`.

`frame` : | a SwfdecAsFrame
Returns : | the next SwfdecAsFrame or `NULL` if this is the bottommost frame.

### swfdec_as_frame_get_script ()

    SwfdecScript*       swfdec_as_frame_get_script          (SwfdecAsFrame *frame);

Gets the script associated with the given `frame`. If the frame references a native function, there will be no script and this function returns `NULL`.

`frame` : | a SwfdecAsFrame
Returns : | The script executed by this frame or `NULL`

### swfdec_as_frame_get_this ()

    SwfdecAsObject*     swfdec_as_frame_get_this            (SwfdecAsFrame *frame);

Gets the this object of the given `frame`. If the frame has no this object, `NULL` is returned.

`frame` : | a SwfdecAsFrame
Returns : | The this object of the frame or `NULL` if none.

### SwfdecAsStackIterator

    typedef struct {
    } 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.

### swfdec_as_stack_iterator_init ()

    SwfdecAsValue*      swfdec_as_stack_iterator_init       (SwfdecAsStackIterator *iter,
                                                             SwfdecAsFrame *frame);

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);
    }

`iter` : | a SwfdecStackIterator
`frame` : | the frame to initialize from
Returns : | the topmost value on the stack of `frame` or `NULL` if none

### swfdec_as_stack_iterator_init_arguments ()

    SwfdecAsValue*      swfdec_as_stack_iterator_init_arguments
                                                            (SwfdecAsStackIterator *iter,
                                                             SwfdecAsFrame *frame);

Initializes a stack iterator to walk the arguments passed to the given `frame`. See `swfdec_as_stack_iterator_init()` about suggested iterator usage.

`iter` : | iterator to be initialized
`frame` : | the frame to initialize from
Returns : | The value of the first argument

### swfdec_as_stack_iterator_next ()

    SwfdecAsValue*      swfdec_as_stack_iterator_next       (SwfdecAsStackIterator *iter);

Gets the next value on the stack.

`iter` : | a SwfdecAsStackIterator
Returns : | The next value on the stack or `NULL` if no more values are on the stack