Fixed to work correctly with AmigaOS 4

This commit is contained in:
Olaf Barthel
2018-06-12 13:53:44 +02:00
parent 593e22abb2
commit ff548d2f81
2 changed files with 68 additions and 21 deletions
+56 -19
View File
@@ -35,6 +35,8 @@
#if defined(__amigaos4__)
#include <dos/obsolete.h>
#else
#define VARARGS68K
#endif /* __amigaos4__ */
#include <string.h>
@@ -376,21 +378,36 @@ static void putch(UBYTE c __asm("d0"))
#endif /* __SASC */
void
void VARARGS68K
_DPRINTF(const char *fmt,...)
{
if(__debug_level >= DEBUGLEVEL_Reports)
{
va_list args;
va_start(args,fmt);
#if defined(__amigaos4__)
{
va_startlinear(args,fmt);
if(debug_file == (BPTR)NULL)
RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL);
else
VFPrintf(debug_file,fmt,args);
if(debug_file == (BPTR)NULL)
RawDoFmt((char *)fmt,va_getlinearva(args, APTR),(VOID (*)())putch,NULL);
else
VFPrintf(debug_file,fmt,va_getlinearva(args, APTR));
va_end(args);
va_end(args);
}
#else
{
va_start(args,fmt);
if(debug_file == (BPTR)NULL)
RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL);
else
VFPrintf(debug_file,fmt,args);
va_end(args);
}
#endif /* __amigaos4__ */
if(debug_file == (BPTR)NULL)
{
@@ -404,26 +421,46 @@ _DPRINTF(const char *fmt,...)
}
}
void
void VARARGS68K
_DLOG(const char *fmt,...)
{
if(__debug_level >= DEBUGLEVEL_Reports)
{
va_list args;
va_start(args,fmt);
if(debug_file == (BPTR)NULL)
#if defined(__amigaos4__)
{
RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL);
}
else
{
VFPrintf(debug_file,fmt,args);
Flush(debug_file);
}
va_startlinear(args,fmt);
va_end(args);
if(debug_file == (BPTR)NULL)
{
RawDoFmt((char *)fmt,va_getlinearva(args, APTR),(VOID (*)())putch,NULL);
}
else
{
VFPrintf(debug_file,fmt,va_getlinearva(args, APTR));
Flush(debug_file);
}
va_end(args);
}
#else
{
va_start(args,fmt);
if(debug_file == (BPTR)NULL)
{
RawDoFmt((char *)fmt,args,(VOID (*)())putch,NULL);
}
else
{
VFPrintf(debug_file,fmt,args);
Flush(debug_file);
}
va_end(args);
}
#endif /* __amigaos4__ */
}
}
Executable → Regular
+12 -2
View File
@@ -96,6 +96,11 @@
#undef DEBUG
#define DEBUG 1
#elif defined(DEBUG) && defined(__GNUC__)
#ifndef __amigaos4__
#define VARARGS68K
#endif /* __amigaos4__ */
void _ASSERT(int x,const char *xs,const char *file,int line,const char *function);
void _SHOWVALUE(unsigned long value,int size,const char *name,const char *file,int line);
void _SHOWPOINTER(void *p,const char *name,const char *file,int line);
@@ -105,8 +110,8 @@
void _LEAVE(const char *file,int line,const char *function);
void _RETURN(const char *file,int line,const char *function,unsigned long result);
void _DPRINTF_HEADER(const char *file,int line);
void _DPRINTF(const char *format,...);
void _DLOG(const char *format,...);
void VARARGS68K _DPRINTF(const char *format,...);
void VARARGS68K _DLOG(const char *format,...);
void _SETDEBUGFILE(BPTR file);
int _SETDEBUGLEVEL(int level);
void _PUSHDEBUGLEVEL(int level);
@@ -139,6 +144,11 @@
#undef DEBUG
#define DEBUG 1
#ifndef __amigaos4__
#undef VARARGS68K
#endif /* __amigaos4__ */
#else
#define ASSERT(x) ((void)0)
#define ENTER() ((void)0)