* Make debugprint.c a C++ file instead of C
* Use std::ostream instead of FILE* for debug printing git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2198 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
595c4838ac
commit
f10cdeb157
|
@ -126,7 +126,7 @@ SOURCE=.\ddimage.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\debugprint.c
|
SOURCE=.\debugprint.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ SOURCE=.\debug.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\debugprint.h
|
SOURCE=.\debugprint.hpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "winstuff.h"
|
#include "winstuff.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "bmphandler.h"
|
#include "bmphandler.h"
|
||||||
|
|
||||||
BMPHandler::BMPHandler() :
|
BMPHandler::BMPHandler() :
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "bteditdoc.h"
|
#include "bteditdoc.h"
|
||||||
#include "brush.h"
|
#include "brush.h"
|
||||||
#include "tiletypes.h"
|
#include "tiletypes.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "btedit.h"
|
#include "btedit.h"
|
||||||
#include "bteditdoc.h"
|
#include "bteditdoc.h"
|
||||||
#include "wfview.h"
|
#include "wfview.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "brushprop.h"
|
#include "brushprop.h"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "mapprefs.h"
|
#include "mapprefs.h"
|
||||||
#include "textureprefs.h"
|
#include "textureprefs.h"
|
||||||
#include "dibdraw.h"
|
#include "dibdraw.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "wfview.h"
|
#include "wfview.h"
|
||||||
#include "textureview.h"
|
#include "textureview.h"
|
||||||
#include "bteditview.h"
|
#include "bteditview.h"
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "bteditdoc.h"
|
#include "bteditdoc.h"
|
||||||
#include "bteditview.h"
|
#include "bteditview.h"
|
||||||
//#include "editstats.h"
|
//#include "editstats.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
//#include "statsview.h"
|
//#include "statsview.h"
|
||||||
#include "tiletypes.h"
|
#include "tiletypes.h"
|
||||||
#include "objectproperties.h"
|
#include "objectproperties.h"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
|
|
||||||
#include "chnkio.h"
|
#include "chnkio.h"
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
|
|
||||||
|
|
|
@ -24,32 +24,28 @@
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include <fstream>
|
||||||
#include "tchar.h"
|
#include "tchar.h"
|
||||||
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
||||||
extern void DebugWinPrint(char *String);
|
extern void DebugWinPrint(char *String);
|
||||||
|
|
||||||
FILE* DebugStream=NULL;
|
static std::ostream* DebugStream = NULL;
|
||||||
|
|
||||||
void DebugOpen(char* LogName)
|
void DebugOpen(const char* LogName)
|
||||||
{
|
{
|
||||||
if(DebugStream) {
|
DebugClose();
|
||||||
fclose(DebugStream);
|
|
||||||
DebugStream = NULL;
|
DebugStream = new std::ofstream(LogName, std::ios_base::binary);
|
||||||
|
|
||||||
|
*DebugStream << "This build : " << __DATE__ << " " << __TIME__ << "\n" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugStream = fopen(LogName,"wb");
|
void DebugClose()
|
||||||
|
|
||||||
fprintf(DebugStream,"This build : %s %s\n\n",__DATE__,__TIME__);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugClose(void)
|
|
||||||
{
|
{
|
||||||
if(DebugStream) {
|
delete DebugStream;
|
||||||
fclose(DebugStream);
|
|
||||||
}
|
|
||||||
DebugStream = NULL;
|
DebugStream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,23 +57,12 @@ void DebugPrint(const TCHAR *format, ...)
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
_vsntprintf(buf,4096,format,args);
|
_vsntprintf(buf,4096,format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
// Display the debug string in any debugger (WINAPI function)
|
||||||
OutputDebugString(buf);
|
OutputDebugString(buf);
|
||||||
if(DebugStream!=NULL) {
|
|
||||||
fprintf(DebugStream,"%s",buf);
|
if(DebugStream)
|
||||||
|
*DebugStream << buf << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugWinPrint(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void DebugOpen(char* LogName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugClose(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -22,9 +22,8 @@
|
||||||
$HeadURL$
|
$HeadURL$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifndef __INCLUDE_DEBUGPRINT_HPP__
|
||||||
extern "C" {
|
#define __INCLUDE_DEBUGPRINT_HPP__
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define DEBUG0
|
//#define DEBUG0
|
||||||
//#define DEBUG1
|
//#define DEBUG1
|
||||||
|
@ -33,9 +32,6 @@ extern "C" {
|
||||||
//#define DEBUG4
|
//#define DEBUG4
|
||||||
#define DEBUG5
|
#define DEBUG5
|
||||||
|
|
||||||
void DebugOpen(char* LogName);
|
|
||||||
void DebugClose(void);
|
|
||||||
|
|
||||||
#ifndef _TCHAR_DEFINED
|
#ifndef _TCHAR_DEFINED
|
||||||
typedef char TCHAR, *PTCHAR;
|
typedef char TCHAR, *PTCHAR;
|
||||||
typedef unsigned char TBYTE , *PTBYTE ;
|
typedef unsigned char TBYTE , *PTBYTE ;
|
||||||
|
@ -44,20 +40,21 @@ typedef unsigned char TBYTE , *PTBYTE ;
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
void DebugOpen(const char* LogName);
|
||||||
|
void DebugClose();
|
||||||
void DebugPrint(const TCHAR *format, ...);
|
void DebugPrint(const TCHAR *format, ...);
|
||||||
#else
|
#else
|
||||||
|
#define DebugOpen
|
||||||
|
#define DebugClose
|
||||||
#define DebugPrint
|
#define DebugPrint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# ifndef ASSERT
|
# ifndef ASSERT
|
||||||
|
|
||||||
# define ASSERT
|
# define ASSERT
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifndef ASSERT
|
# ifndef ASSERT
|
||||||
|
|
||||||
# define DBG_ASSERT(a,b) if(!(a)) { DebugPrint("Assertion Failure in %s, line : %d\n",__FILE__, __LINE__); \
|
# define DBG_ASSERT(a,b) if(!(a)) { DebugPrint("Assertion Failure in %s, line : %d\n",__FILE__, __LINE__); \
|
||||||
DebugPrint(b); \
|
DebugPrint(b); \
|
||||||
DebugPrint("\n"); }
|
DebugPrint("\n"); }
|
||||||
|
@ -106,7 +103,4 @@ void DebugPrint(const TCHAR *format, ...);
|
||||||
#define DBP5
|
#define DBP5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif // __INCLUDE_DEBUGPRINT_HPP__
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "dibdraw.h"
|
#include "dibdraw.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
|
|
||||||
// Create a DIBDraw class with user specified dimensions and colour depth.
|
// Create a DIBDraw class with user specified dimensions and colour depth.
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
//#define FOGGY
|
//#define FOGGY
|
||||||
#define FILTER
|
#define FILTER
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "btedit.h"
|
#include "btedit.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "expandlimitsdlg.h"
|
#include "expandlimitsdlg.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "fileparse.h"
|
#include "fileparse.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
|
|
||||||
fileParser::fileParser(std::istream& file, short flags) :
|
fileParser::fileParser(std::istream& file, short flags) :
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define MAP_MAXWIDTH 256
|
#define MAP_MAXWIDTH 256
|
||||||
#define MAP_MAXHEIGHT 256
|
#define MAP_MAXHEIGHT 256
|
||||||
|
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "gateway.hpp"
|
#include "gateway.hpp"
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#define MAP_MAXWIDTH 256
|
#define MAP_MAXWIDTH 256
|
||||||
#define MAP_MAXHEIGHT 256
|
#define MAP_MAXHEIGHT 256
|
||||||
|
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "gateway.hpp"
|
#include "gateway.hpp"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "grdland.h"
|
#include "grdland.h"
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "btedit.h"
|
#include "btedit.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "initiallimitsdlg.h"
|
#include "initiallimitsdlg.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "keyhandler.h"
|
#include "keyhandler.h"
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "btedit.h"
|
#include "btedit.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "limitsdialog.h"
|
#include "limitsdialog.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "windowsx.h"
|
#include "windowsx.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#include "pcxhandler.h"
|
#include "pcxhandler.h"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "textsel.h"
|
#include "textsel.h"
|
||||||
#include "heightmap.h"
|
#include "heightmap.h"
|
||||||
#include "tiletypes.h"
|
#include "tiletypes.h"
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "textureview.h"
|
#include "textureview.h"
|
||||||
#include "tiletypes.h"
|
#include "tiletypes.h"
|
||||||
#include "autoflagdialog.h"
|
#include "autoflagdialog.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "directx.h"
|
#include "directx.h"
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
|
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
#include "ddimage.h"
|
#include "ddimage.h"
|
||||||
#include "heightmap.h"
|
#include "heightmap.h"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
//#include "DBView.h"
|
//#include "DBView.h"
|
||||||
#include "tiletypes.h"
|
#include "tiletypes.h"
|
||||||
//#include "EditStats.h"
|
//#include "EditStats.h"
|
||||||
#include "debugprint.h"
|
#include "debugprint.hpp"
|
||||||
//#include "DebugWin.h"
|
//#include "DebugWin.h"
|
||||||
#include "objectproperties.h"
|
#include "objectproperties.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue