home *** CD-ROM | disk | FTP | other *** search
- #if !defined(FWEXCLOG_H) && defined(FW_DEBUG)
- #define FWEXCLOG_H
- // This entire file is for debugging only
- //========================================================================================
- //
- // File: FWExcLog.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWCLAINF_H
- #include "FWClaInf.h"
- #endif
-
- #ifndef FWEXCEPT_H
- #include "FWExcept.h"
- #endif
-
- #ifndef FWEXCTAS_H
- #include "FWExcTas.h"
- #endif
-
- #ifndef FWSEXCLO_H
- #include "FWSExcLo.h"
- #endif
-
- //========================================================================================
- // CLASS _FW_CExceptionLog
- //========================================================================================
-
- class _FW_CExceptionLog
- {
-
- public:
-
- static void Initialize(FW_SPrivExceptionLog& globals);
- // Sets log in valid, non-logging state.
- // Should only be called once at startup.
-
- static void Terminate();
- // Terminates all logging.
- // Should only be called once at application exit.
-
- static void StartLog();
- // Starts (resumes) logging. Resets trigger count to zero.
- // We increment the logging counter each time StartLog is called.
- // Logging is only enabled when the counter is above 0.
- // Logging requires tracing, so StartLog calls StartTrace.
-
- static unsigned long StopLog();
- // Suspends logging, and calls StopTrace, which may stop tracing.
- // Returns final trigger counter (number of possible exception points).
-
- static void CauseException(unsigned long triggerPoint);
- static void CauseException(FW_ClassReference exceptionClass);
-
- static void LogException(FW_ClassReference exceptionClass);
- static void TriggerException(FW_ClassReference exceptionClass,
- const _FW_CException &theException);
-
- static FW_SPrivExceptionLog& GetExceptionLogGlobals();
-
- private:
-
- enum
- {
- kExceptionLogGlobalsOffset = 100
- };
- };
-
- //========================================================================================
- // _FW_CExceptionLog inline functions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // _FW_CExceptionLog::GetExceptionLogGlobals
- //----------------------------------------------------------------------------------------
-
- inline FW_SPrivExceptionLog& _FW_CExceptionLog::GetExceptionLogGlobals()
- {
- FW_SPrivExceptionLog *globals = (FW_SPrivExceptionLog*)
- FW_CPrivTaskGlobals::GetTaskGlobals(kExceptionLogGlobalsOffset);
- if (globals->gInitialized == 0)
- Initialize(*globals);
- return *globals;
- }
-
- #endif
-