Support debugging on WinCE. From Savannah patch #6536; this fixes
bug #23497. * builds/win32/ftdebug.c (OutputDebugStringEx): New function/macro as a replacement for OutputDebugStringA (which WinCE doesn't have). Update all callers. (ft_debug_init) [_WIN32_CE]: WinCE apparently doesn't have environment variables.
This commit is contained in:
parent
a984fda881
commit
630e24d965
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-06-09 VaDiM <s_sliva@rambler.ru>
|
||||
|
||||
Support debugging on WinCE. From Savannah patch #6536; this fixes
|
||||
bug #23497.
|
||||
|
||||
* builds/win32/ftdebug.c (OutputDebugStringEx): New function/macro
|
||||
as a replacement for OutputDebugStringA (which WinCE doesn't have).
|
||||
Update all callers.
|
||||
(ft_debug_init) [_WIN32_CE]: WinCE apparently doesn't have
|
||||
environment variables.
|
||||
|
||||
2008-06-09 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* README.CVS: Updated.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* Debugging and logging component for Win32 (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2005 by */
|
||||
/* Copyright 1996-2001, 2002, 2005, 2008 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -48,25 +48,48 @@
|
|||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
|
||||
# include <stdarg.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
# include <windows.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
void
|
||||
OutputDebugStringEx( const char* str )
|
||||
{
|
||||
static WCHAR buf[8192];
|
||||
|
||||
|
||||
int sz = MultiByteToWideChar( CP_ACP, 0, str, -1, buf,
|
||||
sizeof ( buf ) / sizeof ( *buf ) );
|
||||
if ( !sz )
|
||||
lstrcpyW( buf, L"OutputDebugStringEx: MultiByteToWideChar failed" );
|
||||
|
||||
OutputDebugStringW( buf );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define OutputDebugStringEx OutputDebugStringA
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Message( const char* fmt, ... )
|
||||
{
|
||||
static char buf[8192];
|
||||
va_list ap;
|
||||
static char buf[8192];
|
||||
va_list ap;
|
||||
|
||||
|
||||
va_start( ap, fmt );
|
||||
vprintf( fmt, ap );
|
||||
/* send the string to the debugger as well */
|
||||
vsprintf( buf, fmt, ap );
|
||||
OutputDebugStringA( buf );
|
||||
OutputDebugStringEx( buf );
|
||||
va_end( ap );
|
||||
}
|
||||
|
||||
|
@ -74,35 +97,35 @@
|
|||
FT_BASE_DEF( void )
|
||||
FT_Panic( const char* fmt, ... )
|
||||
{
|
||||
static char buf[8192];
|
||||
va_list ap;
|
||||
static char buf[8192];
|
||||
va_list ap;
|
||||
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsprintf( buf, fmt, ap );
|
||||
OutputDebugStringA( buf );
|
||||
OutputDebugStringEx( buf );
|
||||
va_end( ap );
|
||||
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
# ifdef FT_DEBUG_LEVEL_TRACE
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
/* array of trace levels, initialized to 0 */
|
||||
int ft_trace_levels[trace_count];
|
||||
|
||||
/* define array of trace toggle names */
|
||||
# define FT_TRACE_DEF( x ) #x ,
|
||||
#define FT_TRACE_DEF( x ) #x ,
|
||||
|
||||
static const char* ft_trace_toggles[trace_count + 1] =
|
||||
{
|
||||
# include FT_INTERNAL_TRACE_H
|
||||
#include FT_INTERNAL_TRACE_H
|
||||
NULL
|
||||
};
|
||||
|
||||
# undef FT_TRACE_DEF
|
||||
#undef FT_TRACE_DEF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -126,8 +149,19 @@
|
|||
FT_BASE_DEF( void )
|
||||
ft_debug_init( void )
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/* Windows Mobile doesn't have environment API: */
|
||||
/* GetEnvironmentStrings, GetEnvironmentVariable, getenv. */
|
||||
/* */
|
||||
/* FIXME!!! How to set debug mode? */
|
||||
const char* ft2_debug = 0;
|
||||
|
||||
#else
|
||||
|
||||
const char* ft2_debug = getenv( "FT2_DEBUG" );
|
||||
|
||||
#endif
|
||||
|
||||
if ( ft2_debug )
|
||||
{
|
||||
|
@ -196,7 +230,7 @@
|
|||
}
|
||||
|
||||
|
||||
# else /* !FT_DEBUG_LEVEL_TRACE */
|
||||
#else /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
|
@ -206,8 +240,9 @@
|
|||
}
|
||||
|
||||
|
||||
# endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
Loading…
Reference in New Issue