Location:
e32cmn.h
TRAP (_r, _s) { \
TInt& __rref = _r; \
__rref = 0; \
{ TRAP_INSTRUMENTATION_START; } \
try { \
__WIN32SEHTRAP \
TTrapHandler* ____t = User::MarkCleanupStack(); \
_s; \
User::UnMarkCleanupStack(____t); \
{ TRAP_INSTRUMENTATION_NOLEAVE; } \
__WIN32SEHUNTRAP \
} \
catch (XLeaveException& l) \
{ \
__rref = l.GetReason(); \
{ TRAP_INSTRUMENTATION_LEAVE(__rref); } \
} \
catch (...) \
{ \
User::Invariant(); \
} \
{ TRAP_INSTRUMENTATION_END; } \
}
Executes the set of C++ statements _s under a trap harness.
Use this macro as a C++ statement.
_r must be a TInt which has already been declared; if any of the C++ statements _s leaves, then the leave code is returned in _r, otherwise _r is set to KErrNone.
_s can consist of multiple C++ statements; in theory, _s can consist of any legal C++ code but in practice, such statements consist of simple function calls, e.g. Foo() or an assignment of some value to the result of a function call, e.g. functionValue=GetFoo().
A cleanup stack is constructed for the set of C++ statements _s. If any function in _s leaves, objects pushed to the cleanup stack are cleaned-up. In addition, if any of the C++ statements in _s leaves, then remaining C++ code in _s is not executed and any variables which are assigned within that remaining code are not defined.
|