/* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA 94304 endcopyright */ /* * ThreadsDynamicEnvironment.h * Copyright Ó 1990 by Xerox Corporation. All rights reserved. * Last changed by Pavel on May 24, 1990 6:20:59 pm PDT * * Edited by Demers, June 22, 1990 1:23:15 pm PDT */ #ifndef _XR_THREADS_DYNAMIC_ENVIRONMENT_ #define _XR_THREADS_DYNAMIC_ENVIRONMENT_ 1 #ifndef _XR_BASIC_TYPES_ # include "BasicTypes.h" #endif #ifndef _XR_THREADS_INLINES_ # include "ThreadsInlines.h" #endif 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. */ #if XR_GET_DYNAMIC_ENVIRONMENT # define XR_GetDynamicEnvironment() ((XR_DynFrame)(XR_currThread->t_dynEnv)) #endif extern void XR_SetDynamicEnvironment(/* XR_DynFrame df */); /* Sets the dynamic environment of the current thread to df. */ #if XR_SET_DYNAMIC_ENVIRONMENT # define XR_SetDynamicEnvironment(df) \ XR_currThread->t_dynEnv = ((XR_Pointer)(df)) #endif 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 XR_DynFrame XR_FirstCommonParent(/* XR_DynFrame de1, de2 */); /* Returns the first frame that is a tail of both arguments, or NIL if there is none. */ 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. */ extern int XR_RewindTo(/* XR_DynFrame target */); /* The current dynamic environment must be a tail of target. This call has the same effect as XR_SetDynamicEnvironment except that all rewinders in the difference between target and the current dynamic environment are called, each with the current dynamic environment set to what was in effect when they were pushed. Returns -1 if the current dynamic environment is not a tail of target, and 0 otherwise. NOTE that this call will not return at all if any of the rewinders that it calls does not do so. */ #endif /* _XR_THREADS_DYNAMIC_ENVIRONMENT_ */