diagnost.cpp File Reference

(r1785/r1282)

#include "camtypes.h"
#include "diagnost.h"
#include "camelot.h"

Go to the source code of this file.

Functions

BOOL InitDiagnosticPrefs ()
 To obtain the diagnostics preference from Camelot's ini file.
void CDECL DiagnosticFn (LPCTSTR FunctionStr, LPCTSTR pszFormat,...)
 This function is the same as Diagnostic except that it takes an additional function parameter which is concatenated with the format string.
void CDECL Diagnostic (LPCTSTR pszFormat,...)
 This function is used in a similar way to TRACE, but exists in retail builds also. It is designed to aid in technical support. It should be used when resources get low, for example, when it might say: "CreatePen failed" or "BitBlt failed", eg,.

Variables

static INT32 OutputDiagnostics = 0


Function Documentation

void CDECL Diagnostic LPCTSTR  pszFormat,
  ...
 

This function is used in a similar way to TRACE, but exists in retail builds also. It is designed to aid in technical support. It should be used when resources get low, for example, when it might say: "CreatePen failed" or "BitBlt failed", eg,.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/11/93
Parameters:
pszFormat,: Format string (no
required at end) [INPUTS] arguments
- [OUTPUTS]
Returns:
-
if (!SelectPen(blobby)) Diagnostic("SelectPen %d failed", PenIndex);

The strings used will always be in English, must be short & sweet, and must never contain any words you would not say to your mother.

Returns:
Errors: -
See also:
DiagnosticFn

Definition at line 226 of file diagnost.cpp.

00227 {
00228     UINT32                  nBuf;
00229     TCHAR               szBuffer[512];
00230     const TCHAR        *pszLocalFormat;
00231 
00232     pszLocalFormat = pszFormat;
00233 
00234     va_list args;
00235     va_start(args, pszFormat);
00236 
00237     nBuf = camVsnprintf( szBuffer, 512, pszLocalFormat, args );
00238     ASSERT(nBuf < sizeof(szBuffer));
00239 
00240 #if 0
00241 
00242     if ((OutputDiagnostics == 1) && (AfxGetApp() != NULL))
00243         afxDump << AfxGetApp()->m_pszExeName << ": ";
00244 
00245     afxDump << szBuffer << "\n";
00246 #else
00247     String_256 DiagOutput;
00248 
00249     if( OutputDiagnostics == 1 )
00250     {
00251         DiagOutput = AfxGetApp().GetAppName().c_str();
00252         DiagOutput += wxT(": ");
00253     }
00254 
00255     DiagOutput += szBuffer;
00256     DiagOutput += wxT("\n");
00257 
00258 #if defined(__WXMSW__)
00259     OutputDebugString(DiagOutput);
00260 #elif defined(__WXGTK__)
00261     camPrintf( DiagOutput );
00262 #endif
00263 
00264 #endif
00265 
00266     va_end(args);
00267 
00268 }

void CDECL DiagnosticFn LPCTSTR  FunctionStr,
LPCTSTR  pszFormat,
  ...
 

This function is the same as Diagnostic except that it takes an additional function parameter which is concatenated with the format string.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/11/93
Parameters:
FunctionStr,: (no space required at end, a space is inserted before being [INPUTS] concatenated) ` pszFormat: Format string (no
required at end) arguments
- [OUTPUTS]
Returns:
-
The idea of this function is to save space. The compiler settings will recognise multiple uses of the same constant string.

Returns:
Errors: -
See also:
Diagnostic

Definition at line 154 of file diagnost.cpp.

00155 {
00156     UINT32                  nBuf;
00157     TCHAR               szBuffer[512];
00158     const TCHAR        *pszLocalFormat;
00159 
00160     pszLocalFormat = pszFormat;
00161 
00162     va_list args;
00163     va_start(args, pszFormat);
00164 
00165     nBuf = camVsnprintf( szBuffer, 512, pszLocalFormat, args );
00166     
00167     ASSERT(nBuf < sizeof(szBuffer));
00168 
00169 #if 0
00170     if ((OutputDiagnostics == 1) && (AfxGetApp() != NULL))
00171         afxDump << AfxGetApp()->m_pszExeName << ": ";
00172 
00173     afxDump << FunctionStr << ": " << szBuffer << "\n";
00174 #else
00175     String_256 DiagOutput;
00176 
00177     if( OutputDiagnostics == 1 )
00178     {
00179         DiagOutput = AfxGetApp().GetAppName().c_str();
00180         DiagOutput += wxT(": ");
00181     }
00182 
00183     DiagOutput += FunctionStr;
00184     DiagOutput += wxT(": ");
00185     DiagOutput += szBuffer;
00186     DiagOutput += wxT("\n");
00187 
00188 #if defined(__WXMSW__)
00189     OutputDebugString(DiagOutput);
00190 #elif defined(__WXMSW__)
00191 #pragma error( "OutputDebugString equiv. for Linux" )
00192 #endif
00193 
00194 #endif
00195 
00196     va_end(args);
00197     
00198 }

BOOL InitDiagnosticPrefs  ) 
 

To obtain the diagnostics preference from Camelot's ini file.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/93
Returns:
TRUE if preferences retrieved correctly, FALSE otherwise
See also:
Main.cpp

Definition at line 122 of file diagnost.cpp.

00123 {
00124     Camelot.DeclarePref(TEXT("DebugFlags"), TEXT("OutputDiagnostics"), 
00125                         &OutputDiagnostics, FALSE, TRUE);
00126 
00127     return TRUE;
00128 }


Variable Documentation

INT32 OutputDiagnostics = 0 [static]
 

Definition at line 108 of file diagnost.cpp.


Generated on Sat Nov 10 03:49:29 2007 for Camelot by  doxygen 1.4.4