eudora-mac/dflutils.c

1 line
14 KiB
C
Raw Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "CodeFragmentsSupplement.h" #include "dflutils.h" #include "dflsuppl.h" #define FILE_NUM 110 #pragma segment LDAPUtils // Since Apple, in their infinite wisdom, obsoleted this identifier, // and provided nothing to replace it..... enum { kNoConnectionID = 0 }; #if GENERATING68KSEGLOAD #define USEDFLSTUBLOADER 1 #else #define USEDFLSTUBLOADER 0 #endif enum { kCFM68KFileType = 'INIT', kCFM68KCreatorType = 'cfm8' }; enum { kRsrcModOverrideRsrcType = 'DFLS', kRsrcModOverrideRsrcID = 129 }; #if USEDFLSTUBLOADER #define DFLStubSharedLibName "\pDFLStubLib" static RoutineDescriptorPtr DFLStub_GetSharedLibraryUPP = nil; static RoutineDescriptorPtr DFLStub_CloseConnectionUPP = nil; static CFragConnectionID DFLStubLibConnID = kNoConnectionID; static Boolean DFLStubLibLoaded = false; #if GENERATING68KSEGLOAD #pragma mpwc on #endif typedef pascal OSErr (*DFLStub_GetSharedLibraryProcPtr)(ConstStr63Param libName, OSType archType, CFragLoadOptions loadFlags, CFragConnectionID *connID, Ptr *mainAddr, Str255 errMessage); typedef pascal OSErr (*DFLStub_CloseConnectionProcPtr)(CFragConnectionID *connID); #define DFLStub_GetSharedLibrary(libName, archType, loadFlags, connID, mainAddr, errMessage) (*(DFLStub_GetSharedLibraryProcPtr)DFLStub_GetSharedLibraryUPP)((libName), (archType), (loadFlags), (connID), (mainAddr), (errMessage)) #define DFLStub_CloseConnection(connID) (*(DFLStub_CloseConnectionProcPtr)DFLStub_CloseConnectionUPP)(connID) #if GENERATING68KSEGLOAD #pragma mpwc reset #endif OSErr LoadDFLStubLib(OSType libArchType); OSErr UnloadDFLStubLib(void); #endif #if USEDFLSTUBLOADER Boolean useDFLStubLib = true; #else Boolean useDFLStubLib = false; #endif static CFragConnectionID curDFRLibConnID = (void *)kNoConnectionID; static ISAType curDFRLibISA = kOld68kRTA | kM68kISA; static OSErr curDFRProcInitErr = paramErr; void ResetDFRLoaderGlobals(void) { curDFRLibConnID = (void *)kNoConnectionID; curDFRLibISA = kOld68kRTA | kM68kISA; curDFRProcInitErr = paramErr; } void SetDFRLoaderGlobals(CFragConnectionID connID, ISAType connISA) { curDFRLibConnID = connID; curDFRLibISA = connISA; curDFRProcInitErr = noErr; } OSErr DFRLoaderErr(void) { return curDFRProcInitErr; } static void SetDFRRoutineDescriptor(RoutineDescriptorPtr routineRD, ProcInfoType procInfo, Ptr procAddr, ISAType procISA) { if (!routineRD) return; /* FINISH *//* just set most of these fields du