Made this stuff do something sensible for Macintosh. The part about logging the error is temporary.

This commit is contained in:
mcmullen%netscape.com 1998-12-23 22:13:47 +00:00
parent 37216bc6d4
commit 41dfff2b28
3 changed files with 90 additions and 0 deletions

View File

@ -21,8 +21,35 @@
#if defined(_WIN32)
#include <windows.h>
#elif defined(XP_MAC)
//------------------------
#include <MacTypes.h>
#include <Processes.h>
// TEMPORARY UNTIL WE HAVE MACINTOSH ENVIRONMENT VARIABLES THAT CAN TURN ON
// LOGGING ON MACINTOSH
// At this moment, NSPR's logging is a no-op on Macintosh.
#include <stdarg.h>
#include <stdio.h>
#undef PR_LOG
#define PR_LOG(module,level,args) dprintf args
static void dprintf(const char *format, ...)
{
va_list ap;
Str255 buffer;
va_start(ap, format);
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
va_end(ap);
DebugStr(buffer);
}
//------------------------
#endif
/**
* Implementation of the nsDebug methods. Note that this code is
* always compiled in, in case some other module that uses it is
@ -48,6 +75,8 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
#if defined(_WIN32)
long* __p = (long*) 0x7;
*__p = 0x7;
#elif defined(XP_MAC)
ExitToShell();
#endif
}
@ -60,6 +89,7 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
//XXX this works on win32 only for now. For all the other platforms call Abort
#if defined(_WIN32)
::DebugBreak();
#elif defined(XP_MAC)
#else
Abort(aFile, aLine);
#endif

View File

@ -21,8 +21,35 @@
#if defined(_WIN32)
#include <windows.h>
#elif defined(XP_MAC)
//------------------------
#include <MacTypes.h>
#include <Processes.h>
// TEMPORARY UNTIL WE HAVE MACINTOSH ENVIRONMENT VARIABLES THAT CAN TURN ON
// LOGGING ON MACINTOSH
// At this moment, NSPR's logging is a no-op on Macintosh.
#include <stdarg.h>
#include <stdio.h>
#undef PR_LOG
#define PR_LOG(module,level,args) dprintf args
static void dprintf(const char *format, ...)
{
va_list ap;
Str255 buffer;
va_start(ap, format);
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
va_end(ap);
DebugStr(buffer);
}
//------------------------
#endif
/**
* Implementation of the nsDebug methods. Note that this code is
* always compiled in, in case some other module that uses it is
@ -48,6 +75,8 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
#if defined(_WIN32)
long* __p = (long*) 0x7;
*__p = 0x7;
#elif defined(XP_MAC)
ExitToShell();
#endif
}
@ -60,6 +89,7 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
//XXX this works on win32 only for now. For all the other platforms call Abort
#if defined(_WIN32)
::DebugBreak();
#elif defined(XP_MAC)
#else
Abort(aFile, aLine);
#endif

View File

@ -21,8 +21,35 @@
#if defined(_WIN32)
#include <windows.h>
#elif defined(XP_MAC)
//------------------------
#include <MacTypes.h>
#include <Processes.h>
// TEMPORARY UNTIL WE HAVE MACINTOSH ENVIRONMENT VARIABLES THAT CAN TURN ON
// LOGGING ON MACINTOSH
// At this moment, NSPR's logging is a no-op on Macintosh.
#include <stdarg.h>
#include <stdio.h>
#undef PR_LOG
#define PR_LOG(module,level,args) dprintf args
static void dprintf(const char *format, ...)
{
va_list ap;
Str255 buffer;
va_start(ap, format);
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
va_end(ap);
DebugStr(buffer);
}
//------------------------
#endif
/**
* Implementation of the nsDebug methods. Note that this code is
* always compiled in, in case some other module that uses it is
@ -48,6 +75,8 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine)
#if defined(_WIN32)
long* __p = (long*) 0x7;
*__p = 0x7;
#elif defined(XP_MAC)
ExitToShell();
#endif
}
@ -60,6 +89,7 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine)
//XXX this works on win32 only for now. For all the other platforms call Abort
#if defined(_WIN32)
::DebugBreak();
#elif defined(XP_MAC)
#else
Abort(aFile, aLine);
#endif