You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@locus.apache.org on 2000/12/28 18:57:34 UTC
cvs commit: xml-xerces/c/src/util/Platforms/MacOS MacOSPlatformUtils.hpp MacOSPlatformUtils.cpp
jberry 00/12/28 09:57:33
Modified: c/src/util/Platforms/MacOS MacOSPlatformUtils.hpp
MacOSPlatformUtils.cpp
Log:
- Move away from include of Carbon.h; include only needed files instead.
- Fix bug in parsing of upwardly relative paths under classic
(thanks to Lawrence You)
Revision Changes Path
1.5 +15 -3 xml-xerces/c/src/util/Platforms/MacOS/MacOSPlatformUtils.hpp
Index: MacOSPlatformUtils.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Platforms/MacOS/MacOSPlatformUtils.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MacOSPlatformUtils.hpp 2000/10/18 22:19:53 1.4
+++ MacOSPlatformUtils.hpp 2000/12/28 17:57:27 1.5
@@ -55,7 +55,7 @@
*/
/*
- * $Id: MacOSPlatformUtils.hpp,v 1.4 2000/10/18 22:19:53 jberry Exp $
+ * $Id: MacOSPlatformUtils.hpp,v 1.5 2000/12/28 17:57:27 jberry Exp $
*/
#pragma once
@@ -63,9 +63,11 @@
#include <util/XercesDefs.hpp>
#include <cstdlib>
-#if TARGET_API_MAC_CARBON
- #include <Carbon.h>
+#if defined(XML_MACOSX)
+ // Framework includes from ProjectBuilder
+ #include <CarbonCore/Files.h>
#else
+ // Classic includes otherwise
#include <Files.h>
#endif
@@ -105,6 +107,16 @@
bool mFileValid;
};
+
+//
+// Support for customized panic handling:
+// The default handling of panics is not very friendly.
+// To replace it with something more friendly, you'll need to:
+// - #define XML_USE_CUSTOM_PANIC_PROC
+// - Write, and link with, XMLCustomPanicProc
+// - Implement your panic handling within XMLCustomPanicProc.
+//
+extern "C" void XMLCustomPanicProc(XMLPlatformUtils::PanicReasons panicReason, const char* reasonStr);
// Convert fom FSRef/FSSpec to a Unicode character string path.
// Note that you'll need to delete [] that string after you're done with it!
1.18 +29 -10 xml-xerces/c/src/util/Platforms/MacOS/MacOSPlatformUtils.cpp
Index: MacOSPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Platforms/MacOS/MacOSPlatformUtils.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MacOSPlatformUtils.cpp 2000/10/18 22:19:53 1.17
+++ MacOSPlatformUtils.cpp 2000/12/28 17:57:28 1.18
@@ -55,7 +55,7 @@
*/
/*
- * $Id: MacOSPlatformUtils.cpp,v 1.17 2000/10/18 22:19:53 jberry Exp $
+ * $Id: MacOSPlatformUtils.cpp,v 1.18 2000/12/28 17:57:28 jberry Exp $
*/
@@ -97,16 +97,27 @@
#include <memory>
#include <algorithm>
-#if TARGET_API_MAC_CARBON
- #include <Carbon.h>
+#if defined(XML_MACOSX)
+ // Include from Frameworks Headers under ProjectBuilder
+ #include <CarbonCore/Files.h>
+ #include <CarbonCore/Gestalt.h>
+ #include <CarbonCore/TextUtils.h>
+ #include <CarbonCore/TextEncodingConverter.h>
+ #include <CarbonCore/Multiprocessing.h>
+ #include <CarbonCore/DriverSynchronization.h>
+ #include <CarbonCore/DriverServices.h>
+ #include <CoreFoundation/CFString.h>
+ #include <URLAccess/URLAccess.h>
#else
- #include <Files.h>
+ // Classic include styles
+ #include <Files.h>
#include <Gestalt.h>
- #include <Traps.h>
#include <TextUtils.h>
#include <TextEncodingConverter.h>
#include <Multiprocessing.h>
#include <DriverSynchronization.h>
+ #include <DriverServices.h>
+ #include <CFString.h>
#include <URLAccess.h>
#endif
@@ -374,17 +385,25 @@
else
reasonStr = "Unknown error source";
- //
- // This isn't real friendly and should be cleaned up.
- // Replace this code to do whatever you need to do.
- //
char text[256];
std::snprintf(text, sizeof(text), "Xerces Panic Error: %s", reasonStr);
+ //
+ // The default handling of panics is not very friendly.
+ // To replace it with something more friendly, you'll need to:
+ // - #define XML_USE_CUSTOM_PANIC_PROC
+ // - Write, and link with, XMLCustomPanicProc
+ // - Implement your panic handling within XMLCustomPanicProc.
+ //
+#if defined(XML_USE_CUSTOM_PANIC_PROC)
+ XMLCustomPanicProc(reason, reasonStr);
+#else
Str255 pasText;
CopyCStringToPascal(text, pasText);
DebugStr(pasText);
+#endif
+ // Life's got us down. Good-bye world.
std::exit(-1);
}
@@ -1235,7 +1254,7 @@
// Update our spec
if (err == noErr)
- err = FSMakeFSSpec(spec.vRefNum, catInfo.dirInfo.ioDrParID, NULL, &spec);
+ err = FSMakeFSSpec(spec.vRefNum, catInfo.dirInfo.ioDrDirID, NULL, &spec);
break;
}