/* 
 * pThreadsDynamicEnvironment.h -- RS/6000 psuedo-threads work 
 */

#ifndef ←P←THREADS←DYNAMIC←ENVIRONMENT←H
#define ←P←THREADS←DYNAMIC←ENVIRONMENT←H
#include "BasicTypes.h"
#include "Threads.h"

typedef struct XR←DynFrameRep {
    struct XR←DynFrameRep *df←link;
    XR←Pointer df←key;
    XR←Pointer df←data[1];
} *XR←DynFrame;

extern XR←DynFrame
XR←GetDynamicEnvironment();
/*
    Returns the current dynamic environment of the current thread.
*/

extern XR←DynFrame
XR←LookupInDynamicEnvironment(/* XR←Pointer key, XR←DynFrame de */);
/*
    Returns the first frame in de with the given key, or NIL if there
    is none.
*/

extern void
XR←SetDynamicEnvironment(/* XR←DynFrame df */);
/*
    Sets the dynamic environment of the current thread to df.
*/

extern XR←Pointer XR←UnwindFrameKey;

typedef struct XR←UnwindFrameRep {
    XR←DynFrame uf←link;
    XR←Pointer uf←key;
    XR←MesaProc uf←unwinder;
    XR←MesaProc uf←rewinder;
} *XR←UnwindFrame;

extern int
XR←UnwindTo(/* XR←DynFrame target */);
/*
    Target must be a tail of the current dynamic environment.
    This call has the same effect as XR←SetDynamicEnvironment except
    that all unwinders in the difference between the current dynamic
    environment and target are called, each with the current
    dynamic environment set to what was in effect when they were
    pushed.

    Returns -1 if target is not a tail of the current dynamic
    environment, and 0 otherwise.

    NOTE that this call will not return at all if any of the unwinders
    that it calls does not do so.
*/

#endif ←P←THREADS←DYNAMIC←ENVIRONMENT←H