[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Win32 PFile
Hopefully you will find attached some more changes for PenguinFile under
win32.
In PenguinFile.dsp I turned on the rtti for the release version. I also
defined PP_DEBUG
and PP_NDEBUG here rather than in ppconfig-win32.h.diff
I modified debug.h so that it uses DebugBreak in win32. I don't know
whether this is a good thing or not as it doesn't seem to work very
well. I also added a macro called ppEvilTrick to do what a lot of the
other macros in debug.h were doing.
URLInfo.cpp has by far the most problems for win32. Take a careful look
at those changes as they are probably the wrong thing to do. They do
however indicate spots were something is going wrong.
Peter Burns
43a44
> # PROP Ignore_Export_Lib 0
46c47
< # ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
---
> # ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PP_NDEBUG" /FD /c
57c58
< # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
---
> # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"../Release/PenguinFile.dll"
73c74
< # ADD CPP /nologo /MTd /W3 /Gm /GR /GX /Zi /Od /I "../../include" /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
---
> # ADD CPP /nologo /MTd /W3 /Gm /GR /GX /Zi /Od /I "../../include" /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PP_DEBUG" /FD /c
173d172
<
175c174
<
---
> memset(copied_path, 0, copied_path_size);
179c178,180
<
---
> // put a zero on the end to make a null-terminated string
> copied_path[copied_path_size - 16 + 1 + 1] = 0;
> path = copied_path;
183c184
< path += offset;
---
> //path += offset;
230c231
< if (is_absolute)
---
> if (is_absolute && !is_native)
241a243,245
> // the leading / always gets stripped off
> // so a dos type path looks like c/blah/blob.txt
>
256a261
> part_start[0]=&Path[2];
336c341
< path++; // skip the leading slash
---
> //path++; // skip the leading slash
381c386
< if (is_native)
---
> if (!CWDPath.is_native)
391a397,400
> if (fs == ppfFS_pak)
> is_native = true;
> else if (!is_native)
> ToNative();
399,400c408,412
< NewPathLen += 1; /* '/' between the two parts */
< NewPathLen += 1; /* leading '/' (or '\\') */
---
> NewPathLen += 1; /* '/' between the two parts */
> #ifndef PP_SYS_OS_WIN32
> // win32 doesn't have a leading '/' it has a drive letter
> NewPathLen += 1; /* leading '/' (or '\\') */
> #endif
405,406c417,420
< char *NewPath = new char [NewPathLen + 1];
<
---
> char *NewPath = new char [NewPathLen + 1];
> #ifdef PP_SYS_OS_WIN32
> memcpy (NewPath, CWD->GetPath (), CWDLen);
> #else
407a422
> #endif
413,415c428,430
< NewPath [CWDLen + 1] = is_native ? '\\' : '/';
< NewPath [0] = is_native ? '\\' : '/';
<
---
> NewPath [CWDLen] = is_native ? '\\' : '/';
> //NewPath [0] = is_native ? '\\' : '/';
> memcpy (NewPath + CWDLen + 1, path, PathLen);
418a434
> memcpy (NewPath + CWDLen + 1 + 1, path, PathLen);
421c437
< memcpy (NewPath + CWDLen + 1 + 1, path, PathLen);
---
>
540c556
< length = strlen (path);
---
> length = strlen (path);
764c780
< do { URL++; } while (*URL == '/');
---
> //do { URL++; } while (*URL == '/');
42c42
< #define PP_DEBUG 1
---
> /*#define PP_DEBUG 1*/
47a48
> #ifdef PP_DEBUG
48a50,52
> #else
> #define PP_DEBUGLEVEL 0
> #endif
1,274c1,262
< /*
< * Debugging macros & functions
< * #included by PenguinPlay.h - please do not include directly
< *
< * Project : PenguinPlay
< * Part : Generic
< * Authors : Christian Reiniger <warewolf@mayn.de>
< * Adrian Ratnapala <raka@mailhost.bit.net.au>
< * License : See the accompanying file LICENSE
< *
< * Last change by $Author: creinig $
< * on $Date: 1999/12/16 22:41:47 $
< * to $Revision: 1.4 $
< *
< */
<
<
< #ifndef _PP_DEBUG_H
< #define _PP_DEBUG_H
<
<
< /*
< * This is used in the debugging versions of the messaging
< * functions.
< */
< #ifdef __GNUC__
< #define PP_FUNCTION_NAME __PRETTY_FUNCTION__
< #else
< extern const char* _ppNoFuncNameMsg;
< #define PP_FUNCTION_NAME _ppNoFuncNameMsg
< #endif
<
<
<
<
<
< /*****************************************************************************
< *
< * Definition of the Debuglevels:
< *
< * PP_DEBUGLEVEL == 0: No debugging info, ppFatalError () macros *are*
< * evaluated (i.e. they should be only used for *really*
< * critical stuff). Exits the program.
< *
< * PP_DEBUGLEVEL >= 1: Evaluation of ppInternalError () (new macro, used for
< * internal return value checking etc, i.e. stuff that can
< * be ommitted in the final, extensively debugged version)
< * Exits the program.
< *
< * PP_DEBUGLEVEL >= 2: Evaluation of ppWarning (). Debugging info warning the
< * debugger about oddities that shouldn't be (but are not
< * critical)
< * Evaluation of ppError (). Debugging info informing the
< * debugger about a serious error that is most likely
< * not caused by PFile itself. Exits the program.
< *
< * PP_DEBUGLEVEL >= 3: Evaluation of ppAssert () and ppThrow ()
< *
< * PP_DEBUGLEVEL >= 4: Evaluation of ppDebug1 (). Info about entering/leaving
< * major code sections (e.g. "configfile parsing started"
< * / "configfile parsing finished successfully")
< *
< * PP_DEBUGLEVEL >= 5: Evaluation of ppDebug2 (). More detailed progress info
< * (e.g. "Processing configfile line x")
< *
< * PP_DEBUGLEVEL >= 6: Evaluation of ppDebug3 (). medium detail info about
< * the processed data (e.g. "Line contains token
< * 'DefaultResolution' with value '800x600'")
< *
< * PP_DEBUGLEVEL >= 7: Evaluation of ppDebug4 (). Info about variable values
< * at important points (e.g. "(int) DefaultResX = 800 ;
< * (int) DefaultResY = 600")
< *
< * PP_DEBUGLEVEL >= 8: Evaluation of ppDebug5 (). Really excessively detailed
< * information (e.g. "LoopVariable = 1376 ;
< * NoOfCopiedBytes = 327860 ; LastByteVal = 0x3F")
< *
< * Of course That doesn't mean that every piece of code has to give this much
< * debug info ;) But if debug info is given it has to behave this way.
< *
< *
< *
< * Some Notes from Adrian about the code:
< *
< * ----------------------------
< * #define ppDebug (\
< * *_pp_db_lineno_loc()=__LINE__,\
< * *_pp_db_file_loc()=__FILE__,\
< * *_pp_db_func_loc()=_PP_FUNCTION_NAME,\
< * _ppDbgDebug\
< * )
< * --------------------
< *
< * This is an evil C trick to use the comma operator. It
< * sets a few "global variables" to appropriate values, and evaluates
< * to a pointer _ppDbgDebug.
< *
< * Thus :
< * ppDebug(SOME ARGS)
< *
< * becomes equivilent to:
< * Set some global variables to display the source location;
< * _ppDbgDebug(SOME ARGS);
< *
< * On the other hand, when debugging is off, we get
< * (void)(SOME ARGS);
< * This causes, the args to be evaluated if they have side effects,
< * but does not print anything out, since they are just ignored by
< * the cast to void. (Again, the comma operator comes into play).
< *
< * The _pp_db_xxxx__loc() functions are used instead of straight globals
< * so we can fix them to be thread safe (this works like errno in libc).
< *
< *
< */
<
<
<
< /* For all debugging macros */
< PP_EXTC int* _pp_db_lineno_loc(void);
< PP_EXTC const char** _pp_db_file_loc(void);
< PP_EXTC const char** _pp_db_func_loc(void);
<
< /* Stub to avoid some warnings on non-GNU compilers */
< PP_EXTC void _ppPrintfStyleStub (const char *msg, ...) PP_PRINTF_STYLE(1,2);
<
<
< /* Always evaluated */
< PP_EXTC void _ppFatalError(const char* msg, ...) PP_PRINTF_STYLE(1,2);
<
< #define ppFatalError (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< _ppFatalError\
< )
<
<
<
< #if PP_DEBUGLEVEL >= 1
< PP_EXTC void _ppInternalError(const char* msg, ...) PP_PRINTF_STYLE(1,2);
<
< #define ppInternalError (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< _ppInternalError\
< )
< #else
< # define ppInternalError _ppPrintfStyleStub
< #endif
<
<
< #if PP_DEBUGLEVEL >= 2
< PP_EXTC void _ppWarning (const char *msg, ...) PP_PRINTF_STYLE(1,2);
< PP_EXTC void _ppError (const char *msg, ...) PP_PRINTF_STYLE(1, 2);
<
< #define ppWarning (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< _ppWarning\
< )
<
< #define ppError (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< _ppError\
< )
< #else
< # define ppWarning _ppPrintfStyleStub
< # define ppError _ppPrintfStyleStub
< #endif
<
<
< #if PP_DEBUGLEVEL >= 3
< #define ppAssert(expr) (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< ((expr) ? (void) (0) : _ppInternalError ("Assertion \"%s\" failed", #expr))\
< )
<
< #define ppAssertArg(expr) (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< ((expr) ? (void) (0) : _ppInternalError ("Invalid Argument: Assertion \"%s\" does not hold", #expr))\
< )
<
< #define ppThrow(XCept, details) (\
< throw (XCept (PP_FUNCTION_NAME, details, __FILE__, __LINE__)) \
< )
< #else
< #define ppAssert(expr)
< #define ppAssertArg(expr)
< #define ppThrow(XCept, details) (\
< throw (XCept (PP_FUNCTION_NAME, details)) \
< )
< #endif
<
<
< #if PP_DEBUGLEVEL >= 4
< PP_EXTC void _ppDebug(const char* msg, ...) PP_PRINTF_STYLE(1,2);
<
< #define ppDebug1 (\
< *_pp_db_lineno_loc()=__LINE__,\
< *_pp_db_file_loc()=__FILE__,\
< *_pp_db_func_loc()=PP_FUNCTION_NAME,\
< _ppDebug\
< )
<
< #define ppDebug ppDebug1 // DEPRECATED ! Use ppDebugx () instead
<
< #else
< # define ppDebug1 _ppPrintfStyleStub
< # define ppDebug _ppPrintfStyleStub // DEPRECATED ! Use ppDebugx () instead
< #endif
<
<
< #if PP_DEBUGLEVEL >= 5
< #define ppDebug2 ppDebug
< #else
< # define ppDebug2 _ppPrintfStyleStub
< #endif
<
<
< #if PP_DEBUGLEVEL >= 6
< #define ppDebug3 ppDebug
< #else
< # define ppDebug3 _ppPrintfStyleStub
< #endif
<
<
< #if PP_DEBUGLEVEL >= 7
< #define ppDebug4 ppDebug
< #else
< # define ppDebug4 _ppPrintfStyleStub
< #endif
<
<
< #if PP_DEBUGLEVEL >= 8
< #define ppDebug5 ppDebug
< #else
< # define ppDebug5 _ppPrintfStyleStub
< #endif
<
<
<
<
< /*
< * ------------------------------------------------------------ Debug Messages
< *
< * FIX: Do not use these yet - They will most likely be completely rewritten
< */
<
<
<
< #define PP_ERROR_INTERNAL ppInternalEror ("Unknown internal PenguinPlay error")
<
< #define PP_WARN_NEW_FAIL ppWarning ("Out of memory")
< #define PP_WARN_INVALID_ARG ppWarning ("Invalid argument")
< #define PP_WARN_INVALID_PATH ppWarning ("Invalid path")
< #define PP_WARN_INVALID_FILE ppWarning ("Non-existant file specified in path")
< #define PP_WARN_INVALID_DIR ppWarning ("Non-existant directory specified in path")
< #define PP_WARN_INVALID_FS ppWarning ("Invalid file-system specifier")
< #define PP_WARN_NO_CONSTRUCT ppWarning ("Object could not be constructed")
< #define PP_WARN_NO_COMPONENT_INIT ppWarning ("Could not initialise component")
<
<
<
<
< #endif
---
> /*
> * Debugging macros & functions
> * #included by PenguinPlay.h - please do not include directly
> *
> * Project : PenguinPlay
> * Part : Generic
> * Authors : Christian Reiniger <warewolf@mayn.de>
> * Adrian Ratnapala <raka@mailhost.bit.net.au>
> * License : See the accompanying file LICENSE
> *
> * Last change by $Author: creinig $
> * on $Date: 1999/12/16 22:41:47 $
> * to $Revision: 1.4 $
> *
> */
>
>
> #ifndef _PP_DEBUG_H
> #define _PP_DEBUG_H
>
>
> /*
> * This is used in the debugging versions of the messaging
> * functions.
> */
> #ifdef __GNUC__
> #define PP_FUNCTION_NAME __PRETTY_FUNCTION__
> #else
> #define PP_FUNCTION_NAME "Unknown Function"
> #endif
>
>
>
>
>
> /*****************************************************************************
> *
> * Definition of the Debuglevels:
> *
> * PP_DEBUGLEVEL == 0: No debugging info, ppFatalError () macros *are*
> * evaluated (i.e. they should be only used for *really*
> * critical stuff). Exits the program.
> *
> * PP_DEBUGLEVEL >= 1: Evaluation of ppInternalError () (new macro, used for
> * internal return value checking etc, i.e. stuff that can
> * be ommitted in the final, extensively debugged version)
> * Exits the program.
> *
> * PP_DEBUGLEVEL >= 2: Evaluation of ppWarning (). Debugging info warning the
> * debugger about oddities that shouldn't be (but are not
> * critical)
> * Evaluation of ppError (). Debugging info informing the
> * debugger about a serious error that is most likely
> * not caused by PFile itself. Exits the program.
> *
> * PP_DEBUGLEVEL >= 3: Evaluation of ppAssert () and ppThrow ()
> *
> * PP_DEBUGLEVEL >= 4: Evaluation of ppDebug1 (). Info about entering/leaving
> * major code sections (e.g. "configfile parsing started"
> * / "configfile parsing finished successfully")
> *
> * PP_DEBUGLEVEL >= 5: Evaluation of ppDebug2 (). More detailed progress info
> * (e.g. "Processing configfile line x")
> *
> * PP_DEBUGLEVEL >= 6: Evaluation of ppDebug3 (). medium detail info about
> * the processed data (e.g. "Line contains token
> * 'DefaultResolution' with value '800x600'")
> *
> * PP_DEBUGLEVEL >= 7: Evaluation of ppDebug4 (). Info about variable values
> * at important points (e.g. "(int) DefaultResX = 800 ;
> * (int) DefaultResY = 600")
> *
> * PP_DEBUGLEVEL >= 8: Evaluation of ppDebug5 (). Really excessively detailed
> * information (e.g. "LoopVariable = 1376 ;
> * NoOfCopiedBytes = 327860 ; LastByteVal = 0x3F")
> *
> * Of course That doesn't mean that every piece of code has to give this much
> * debug info ;) But if debug info is given it has to behave this way.
> *
> *
> *
> * Some Notes from Adrian about the code:
> *
> * ----------------------------
> * #define ppDebug (\
> * *_pp_db_lineno_loc()=__LINE__,\
> * *_pp_db_file_loc()=__FILE__,\
> * *_pp_db_func_loc()=_PP_FUNCTION_NAME,\
> * _ppDbgDebug\
> * )
> * --------------------
> *
> * This is an evil C trick to use the comma operator. It
> * sets a few "global variables" to appropriate values, and evaluates
> * to a pointer _ppDbgDebug.
> *
> * Thus :
> * ppDebug(SOME ARGS)
> *
> * becomes equivilent to:
> * Set some global variables to display the source location;
> * _ppDbgDebug(SOME ARGS);
> *
> * On the other hand, when debugging is off, we get
> * (void)(SOME ARGS);
> * This causes, the args to be evaluated if they have side effects,
> * but does not print anything out, since they are just ignored by
> * the cast to void. (Again, the comma operator comes into play).
> *
> * The _pp_db_xxxx__loc() functions are used instead of straight globals
> * so we can fix them to be thread safe (this works like errno in libc).
> *
> *
> */
>
> #ifdef PP_SYS_OS_WIN32
> #ifndef WIN32_LEAN_AND_MEAN
> #define WIN32_LEAN_AND_MEAN
> #define STRICT
> #endif
> #include <windows.h>
> #define PP_DEBUG_BREAK DebugBreak()
> #else
> #define PP_DEBUG_BREAK 0
> #endif
>
> #define ppEvilTrick(FunPointer) (\
> PP_DEBUG_BREAK, \
> *_pp_db_lineno_loc()=__LINE__,\
> *_pp_db_file_loc()=__FILE__,\
> *_pp_db_func_loc()=PP_FUNCTION_NAME,\
> FunPointer \
> )
>
>
> /* For all debugging macros */
> PP_EXTC int* _pp_db_lineno_loc(void);
> PP_EXTC const char** _pp_db_file_loc(void);
> PP_EXTC const char** _pp_db_func_loc(void);
>
> /* Stub to avoid some warnings on non-GNU compilers */
> PP_EXTC void _ppPrintfStyleStub (const char *msg, ...) PP_PRINTF_STYLE(1,2);
>
>
> /* Always evaluated */
> PP_EXTC void _ppFatalError(const char* msg, ...) PP_PRINTF_STYLE(1,2);
>
> #define ppFatalError ppEvilTrick(_ppFatalError)
>
>
>
> #if PP_DEBUGLEVEL >= 1
> PP_EXTC void _ppInternalError(const char* msg, ...) PP_PRINTF_STYLE(1,2);
>
> #define ppInternalError ppEvilTrick(_ppInternalError)
>
> #else
> # define ppInternalError _ppPrintfStyleStub
> #endif
>
>
> #if PP_DEBUGLEVEL >= 2
> PP_EXTC void _ppWarning (const char *msg, ...) PP_PRINTF_STYLE(1,2);
> PP_EXTC void _ppError (const char *msg, ...) PP_PRINTF_STYLE(1, 2);
>
> #define ppWarning ppEvilTrick(_ppWarning)
>
> #define ppError ppEvilTrick(_ppError)
>
> #else
> # define ppWarning _ppPrintfStyleStub
> # define ppError _ppPrintfStyleStub
> #endif
>
>
> #if PP_DEBUGLEVEL >= 3
> #define ppAssert(expr) \
> if (!(expr)) {ppEvilTrick(_ppInternalError ("Assertion \"%s\" failed", #expr));}
>
>
> #define ppAssertArg(expr) \
> if (!(expr)) {ppEvilTrick(_ppInternalError ("Invalid Argument: Assertion \"%s\" does not hold", #expr));}
>
>
> #define ppThrow(XCept, details) (\
> throw (XCept (PP_FUNCTION_NAME, details, __FILE__, __LINE__)) \
> )
> #else
> #define ppAssert(expr)
> #define ppAssertArg(expr)
> #define ppThrow(XCept, details) (\
> throw (XCept (PP_FUNCTION_NAME, details)) \
> )
> #endif
>
>
> #if PP_DEBUGLEVEL >= 4
> PP_EXTC void _ppDebug(const char* msg, ...) PP_PRINTF_STYLE(1,2);
>
> #define ppDebug1 ppEvilTrick(_ppDebug)
>
> #define ppDebug ppDebug1 // DEPRECATED ! Use ppDebugx () instead
>
> #else
> # define ppDebug1 _ppPrintfStyleStub
> # define ppDebug _ppPrintfStyleStub // DEPRECATED ! Use ppDebugx () instead
> #endif
>
>
> #if PP_DEBUGLEVEL >= 5
> #define ppDebug2 ppDebug
> #else
> # define ppDebug2 _ppPrintfStyleStub
> #endif
>
>
> #if PP_DEBUGLEVEL >= 6
> #define ppDebug3 ppDebug
> #else
> # define ppDebug3 _ppPrintfStyleStub
> #endif
>
>
> #if PP_DEBUGLEVEL >= 7
> #define ppDebug4 ppDebug
> #else
> # define ppDebug4 _ppPrintfStyleStub
> #endif
>
>
> #if PP_DEBUGLEVEL >= 8
> #define ppDebug5 ppDebug
> #else
> # define ppDebug5 _ppPrintfStyleStub
> #endif
>
>
>
>
> /*
> * ------------------------------------------------------------ Debug Messages
> *
> * FIX: Do not use these yet - They will most likely be completely rewritten
> */
>
>
>
> #define PP_ERROR_INTERNAL ppInternalEror ("Unknown internal PenguinPlay error")
>
> #define PP_WARN_NEW_FAIL ppWarning ("Out of memory")
> #define PP_WARN_INVALID_ARG ppWarning ("Invalid argument")
> #define PP_WARN_INVALID_PATH ppWarning ("Invalid path")
> #define PP_WARN_INVALID_FILE ppWarning ("Non-existant file specified in path")
> #define PP_WARN_INVALID_DIR ppWarning ("Non-existant directory specified in path")
> #define PP_WARN_INVALID_FS ppWarning ("Invalid file-system specifier")
> #define PP_WARN_NO_CONSTRUCT ppWarning ("Object could not be constructed")
> #define PP_WARN_NO_COMPONENT_INIT ppWarning ("Could not initialise component")
>
>
>
>
> #endif