|
From: Andre R. <and...@us...> - 2004-11-29 07:16:54
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27448/Common/source Modified Files: langdll.c langverbs.c shell.c Log Message: Implemented the DLL interface in the Carbon/Mach-O build to be backwards compatible with existing Carbon/CFM shared libraries. Index: shell.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/shell.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shell.c 22 Nov 2004 04:43:56 -0000 1.6 --- shell.c 29 Nov 2004 07:16:42 -0000 1.7 *************** *** 77,80 **** --- 77,81 ---- #include "services.h" #include "WinSockNetEvents.h" + #include "langdll.h" /*2004-11-29 aradke: for dllinitverbs*/ #ifdef flcomponent *************** *** 1320,1323 **** --- 1321,1326 ---- quicktimeinitverbs (); + dllinitverbs (); /*2004-11-29 aradke: langdll.c*/ + #endif Index: langverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langverbs.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** langverbs.c 22 Nov 2004 03:52:56 -0000 1.6 --- langverbs.c 29 Nov 2004 07:16:41 -0000 1.7 *************** *** 3142,3151 **** return (callscriptverb (hparam1, v)); - #if defined(WIN95VERSION) || (defined(MACVERSION) && !TARGET_RT_MAC_MACHO) - /* - 2004-11-09 aradke: calling DLLs through the Code Fragment Manager (CFM) - doesn't work yet on Carbon/Mach-O. throw an error instead of crashing. - */ - case dllcallfunc: case calldllfunc: /* this is remaining for historical usage per Dave. rab: 5.0b4 1/6/98 */ --- 3142,3145 ---- *************** *** 3160,3165 **** case dllisloadedfunc: return (dllisloadedverb (hparam1, v)); ! #endif ! case packwindowfunc: return (langpackwindowverb (hparam1, v)); --- 3154,3158 ---- case dllisloadedfunc: return (dllisloadedverb (hparam1, v)); ! case packwindowfunc: return (langpackwindowverb (hparam1, v)); Index: langdll.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langdll.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** langdll.c 30 Oct 2004 23:15:04 -0000 1.3 --- langdll.c 29 Nov 2004 07:16:41 -0000 1.4 *************** *** 68,71 **** --- 68,74 ---- #include "langdll.h" + #if defined(MACVERSION) && TARGET_RT_MAC_MACHO + #include "CallMachOFramework.h" + #endif #define NEW_DLL_INTERFACE 1 /* 2002-11-03 AR: defined to enable new DLL interface */ *************** *** 136,185 **** static tydllinfohandle loadeddlls; /* linked list of currently loaded stay-resident DLLs */ - /* - static const XDLLProcTable dllcallbacks = { /+ we create a copy of this struct on the stack for every call +/ - extfrontierAlloc, - extfrontierReAlloc, - extfrontierLock, - extfrontierUnlock, - extfrontierFree, - extfrontierSize, - - extOdbGetCurrentRoot, - extOdbNewFile, - extOdbOpenFile, - extOdbSaveFile, - extOdbCloseFile, - extOdbDefined, - extOdbDelete, - extOdbGetType, - extOdbCountItems, - extOdbGetNthItem, - extOdbGetValue, - extOdbSetValue, - extOdbNewTable, - extOdbGetModDate, - extOdbDisposeValue, - extOdbGetError, - - extDoScript, - extDoScriptText, - - extOdbNewListValue, - extOdbGetListCount, - extOdbDeleteListValue, - extOdbSetListValue, - extOdbGetListValue, - extOdbAddListValue, ! extInvoke, ! extCoerce, - extCallScript, - extCallScriptText, - - extThreadYield, - extThreadSleep - }; - */ #else --- 139,145 ---- static tydllinfohandle loadeddlls; /* linked list of currently loaded stay-resident DLLs */ ! static XDLLProcTable *dllcallbacks; /* global pointer to array of callback functions */ #else *************** *** 1074,1077 **** --- 1034,1041 ---- hnext = (**h).hashlink; + + #if defined(MACVERSION) && TARGET_RT_MAC_MACHO + disposemachofuncptr ((void *) (**h).procaddress); + #endif disposehandle ((Handle) h); *************** *** 1723,1726 **** --- 1687,1694 ---- (**hprocinfo).moduleUPP = (UniversalProcPtr) &(**hprocinfo).moduledesc; } + #elif TARGET_RT_MAC_MACHO + if (err == noErr) { + (**hprocinfo).procaddress = convertcfmtomachofuncptr ((**hprocinfo).procaddress); + } #endif #endif *************** *** 1744,1752 **** */ - XDLLProcTable calltable; boolean fl = false; - fillcalltable (&calltable); - lockhandle ((Handle) hprocinfo); /* just to be sure our data doesn't move around */ --- 1712,1717 ---- *************** *** 1770,1779 **** #if MACVERSION && !TARGET_API_MAC_CARBON #if GENERATINGCFM ! fl = CallUniversalProc ((**hprocinfo).moduleUPP, uppdllcallProcInfo, params, &calltable); #else ! fl = (*(tyDLLEXTROUTINE) ((**hprocinfo).moduleUPP)) (params, &calltable); #endif #else ! fl = (*(**hprocinfo).procaddress) (params, &calltable); #endif --- 1735,1744 ---- #if MACVERSION && !TARGET_API_MAC_CARBON #if GENERATINGCFM ! fl = CallUniversalProc ((**hprocinfo).moduleUPP, uppdllcallProcInfo, params, dllcallbacks); #else ! fl = (*(tyDLLEXTROUTINE) ((**hprocinfo).moduleUPP)) (params, dllcallbacks); #endif #else ! fl = (*(**hprocinfo).procaddress) (params, dllcallbacks); #endif *************** *** 1913,1916 **** --- 1878,1885 ---- /* Dispose proc info here because we didn't ask for the hash table to be built */ + #if defined(MACVERSION) && TARGET_RT_MAC_MACHO + disposemachofuncptr ((void*) (**hprocinfo).procaddress); + #endif + disposehandle ((Handle) hprocinfo); *************** *** 2375,2394 **** call the dll. */ - XDLLProcTable calltable; boolean fl = false; - /*Need to initialize the callback table*/ - fillcalltable (&calltable); - //#endif - - - // dllcall.frontiercallback = ??? - - // - releasethreadglobals (); #ifdef WIN95VERSION ! fl = (*(dllinfo->procAddress)) (dllcall, &calltable); #endif --- 2344,2353 ---- call the dll. */ boolean fl = false; releasethreadglobals (); #ifdef WIN95VERSION ! fl = (*(dllinfo->procAddress)) (dllcall, dllcallbacks); #endif *************** *** 2397,2407 **** //Code change by Timothy Paustian Friday, June 16, 2000 1:13:28 PM //Changed to Opaque call for Carbon - we don't need UPPs in Carbon. ! //fl = (*(tyDLLEXTROUTINE) (dllinfo->moduleUPP)) (dllcall, &calltable); // call it ! fl = (*(dllinfo->procAddress)) (dllcall, &calltable); // call it #else #if GENERATINGCFM ! fl = CallUniversalProc (dllinfo->moduleUPP, uppdllcallProcInfo, dllcall, &calltable); #else ! fl = (*(tyDLLEXTROUTINE) (dllinfo->moduleUPP)) (dllcall, &calltable); // call it #endif #endif --- 2356,2366 ---- //Code change by Timothy Paustian Friday, June 16, 2000 1:13:28 PM //Changed to Opaque call for Carbon - we don't need UPPs in Carbon. ! //fl = (*(tyDLLEXTROUTINE) (dllinfo->moduleUPP)) (dllcall, dllcallbacks); // call it ! fl = (*(dllinfo->procAddress)) (dllcall, dllcallbacks); // call it #else #if GENERATINGCFM ! fl = CallUniversalProc (dllinfo->moduleUPP, uppdllcallProcInfo, dllcall, dllcallbacks); #else ! fl = (*(tyDLLEXTROUTINE) (dllinfo->moduleUPP)) (dllcall, dllcallbacks); // call it #endif #endif *************** *** 2415,2485 **** } /*langcalldll*/ - #endif /* NEW_DLL_INTERFACE */ - - void fillcalltable (XDLLProcTable * calltable) { ! /* ! 2003-06-16 AR: We got some crash reports on Mac OS Classic ! implicating the new DLL interface where the stdlogs did not ! include a proper stack backtrace. Therefore, let's abandon ! the idea of using a global dllcallbacks table and switch ! back to building it on the fly for every call. ! */ ! /* ! #ifdef NEW_DLL_INTERFACE ! *calltable = dllcallbacks; ! ! #else ! */ ! calltable->xMemAlloc = extfrontierAlloc; ! calltable->xMemResize = extfrontierReAlloc; ! calltable->xMemLock = extfrontierLock; ! calltable->xMemUnlock = extfrontierUnlock; ! calltable->xMemFree = extfrontierFree; ! calltable->xMemGetSize = extfrontierSize; ! calltable->xOdbGetCurrentRoot = extOdbGetCurrentRoot; ! calltable->xOdbNewFile = extOdbNewFile; ! calltable->xOdbOpenFile = extOdbOpenFile; ! calltable->xOdbSaveFile = extOdbSaveFile; ! calltable->xOdbCloseFile = extOdbCloseFile; ! calltable->xOdbDefined = extOdbDefined; ! calltable->xOdbDelete = extOdbDelete; ! calltable->xOdbGetType = extOdbGetType; ! calltable->xOdbCountItems = extOdbCountItems; ! calltable->xOdbGetNthItem = extOdbGetNthItem; ! calltable->xOdbGetValue = extOdbGetValue; ! calltable->xOdbSetValue = extOdbSetValue; ! calltable->xOdbNewTable = extOdbNewTable; ! calltable->xOdbGetModDate = extOdbGetModDate; ! calltable->xOdbDisposeValue = extOdbDisposeValue; ! calltable->xOdbGetError = extOdbGetError; ! calltable->xDoScript = extDoScript; ! calltable->xDoScriptText = extDoScriptText; ! calltable->xOdbNewListValue = extOdbNewListValue; ! calltable->xOdbGetListCount = extOdbGetListCount; ! calltable->xOdbDeleteListValue = extOdbDeleteListValue; ! calltable->xOdbSetListValue = extOdbSetListValue; ! calltable->xOdbGetListValue = extOdbGetListValue; ! calltable->xOdbAddListValue = extOdbAddListValue; ! calltable->xInvoke = extInvoke; ! calltable->xCoerce = extCoerce; ! ! calltable->xCallScript = extCallScript; ! calltable->xCallScriptText = extCallScriptText; ! calltable->xThreadYield = extThreadYield; ! calltable->xThreadSleep = extThreadSleep; ! /* #endif - */ - } /*fillcalltable*/ --- 2374,2531 ---- } /*langcalldll*/ #endif /* NEW_DLL_INTERFACE */ ! void fillcalltable (XDLLProcTable *pt) { ! #if defined(MACVERSION) && TARGET_RT_MAC_MACHO ! pt->xMemAlloc = convertmachotocfmfuncptr (&extfrontierAlloc); ! pt->xMemResize = convertmachotocfmfuncptr (&extfrontierReAlloc); ! pt->xMemLock = convertmachotocfmfuncptr (&extfrontierLock); ! pt->xMemUnlock = convertmachotocfmfuncptr (&extfrontierUnlock); ! pt->xMemFree = convertmachotocfmfuncptr (&extfrontierFree); ! pt->xMemGetSize = convertmachotocfmfuncptr (&extfrontierSize); ! pt->xOdbGetCurrentRoot = convertmachotocfmfuncptr (&extOdbGetCurrentRoot); ! pt->xOdbNewFile = convertmachotocfmfuncptr (&extOdbNewFile); ! pt->xOdbOpenFile = convertmachotocfmfuncptr (&extOdbOpenFile); ! pt->xOdbSaveFile = convertmachotocfmfuncptr (&extOdbSaveFile); ! pt->xOdbCloseFile = convertmachotocfmfuncptr (&extOdbCloseFile); ! pt->xOdbDefined = convertmachotocfmfuncptr (&extOdbDefined); ! pt->xOdbDelete = convertmachotocfmfuncptr (&extOdbDelete); ! pt->xOdbGetType = convertmachotocfmfuncptr (&extOdbGetType); ! pt->xOdbCountItems = convertmachotocfmfuncptr (&extOdbCountItems); ! pt->xOdbGetNthItem = convertmachotocfmfuncptr (&extOdbGetNthItem); ! pt->xOdbGetValue = convertmachotocfmfuncptr (&extOdbGetValue); ! pt->xOdbSetValue = convertmachotocfmfuncptr (&extOdbSetValue); ! pt->xOdbNewTable = convertmachotocfmfuncptr (&extOdbNewTable); ! pt->xOdbGetModDate = convertmachotocfmfuncptr (&extOdbGetModDate); ! pt->xOdbDisposeValue = convertmachotocfmfuncptr (&extOdbDisposeValue); ! pt->xOdbGetError = convertmachotocfmfuncptr (&extOdbGetError); ! pt->xDoScript = convertmachotocfmfuncptr (&extDoScript); ! pt->xDoScriptText = convertmachotocfmfuncptr (&extDoScriptText); ! pt->xOdbNewListValue = convertmachotocfmfuncptr (&extOdbNewListValue); ! pt->xOdbGetListCount = convertmachotocfmfuncptr (&extOdbGetListCount); ! pt->xOdbDeleteListValue = convertmachotocfmfuncptr (&extOdbDeleteListValue); ! pt->xOdbSetListValue = convertmachotocfmfuncptr (&extOdbSetListValue); ! pt->xOdbGetListValue = convertmachotocfmfuncptr (&extOdbGetListValue); ! pt->xOdbAddListValue = convertmachotocfmfuncptr (&extOdbAddListValue); ! pt->xInvoke = convertmachotocfmfuncptr (&extInvoke); ! pt->xCoerce = convertmachotocfmfuncptr (&extCoerce); ! ! pt->xCallScript = convertmachotocfmfuncptr (&extCallScript); ! pt->xCallScriptText = convertmachotocfmfuncptr (&extCallScriptText); ! ! pt->xThreadYield = convertmachotocfmfuncptr (&extThreadYield); ! pt->xThreadSleep = convertmachotocfmfuncptr (&extThreadSleep); ! ! #else ! ! pt->xMemAlloc = &extfrontierAlloc; ! pt->xMemResize = &extfrontierReAlloc; ! pt->xMemLock = &extfrontierLock; ! pt->xMemUnlock = &extfrontierUnlock; ! pt->xMemFree = &extfrontierFree; ! pt->xMemGetSize = &extfrontierSize; ! ! pt->xOdbGetCurrentRoot = &extOdbGetCurrentRoot; ! pt->xOdbNewFile = &extOdbNewFile; ! pt->xOdbOpenFile = &extOdbOpenFile; ! pt->xOdbSaveFile = &extOdbSaveFile; ! pt->xOdbCloseFile = &extOdbCloseFile; ! pt->xOdbDefined = &extOdbDefined; ! pt->xOdbDelete = &extOdbDelete; ! pt->xOdbGetType = &extOdbGetType; ! pt->xOdbCountItems = &extOdbCountItems; ! pt->xOdbGetNthItem = &extOdbGetNthItem; ! pt->xOdbGetValue = &extOdbGetValue; ! pt->xOdbSetValue = &extOdbSetValue; ! pt->xOdbNewTable = &extOdbNewTable; ! pt->xOdbGetModDate = &extOdbGetModDate; ! pt->xOdbDisposeValue = &extOdbDisposeValue; ! pt->xOdbGetError = &extOdbGetError; ! ! pt->xDoScript = &extDoScript; ! pt->xDoScriptText = &extDoScriptText; ! ! pt->xOdbNewListValue = &extOdbNewListValue; ! pt->xOdbGetListCount = &extOdbGetListCount; ! pt->xOdbDeleteListValue = &extOdbDeleteListValue; ! pt->xOdbSetListValue = &extOdbSetListValue; ! pt->xOdbGetListValue = &extOdbGetListValue; ! pt->xOdbAddListValue = &extOdbAddListValue; ! ! pt->xInvoke = &extInvoke; ! pt->xCoerce = &extCoerce; ! ! pt->xCallScript = &extCallScript; ! pt->xCallScriptText = &extCallScriptText; ! ! pt->xThreadYield = &extThreadYield; ! pt->xThreadSleep = &extThreadSleep; ! ! #endif ! ! } /*fillcalltable*/ ! ! ! #if 0 ! ! void smashcalltable (XDLLProcTable *pt) { ! ! #if defined(MACVERSION) && TARGET_RT_MAC_MACHO ! ! disposecfmfuncptr (pt->xMemAlloc); ! disposecfmfuncptr (pt->xMemResize); ! disposecfmfuncptr (pt->xMemLock); ! disposecfmfuncptr (pt->xMemUnlock); ! disposecfmfuncptr (pt->xMemFree); ! disposecfmfuncptr (pt->xMemGetSize); ! ! disposecfmfuncptr (pt->xOdbGetCurrentRoot); ! disposecfmfuncptr (pt->xOdbNewFile); ! disposecfmfuncptr (pt->xOdbOpenFile); ! disposecfmfuncptr (pt->xOdbSaveFile); ! disposecfmfuncptr (pt->xOdbCloseFile); ! disposecfmfuncptr (pt->xOdbDefined); ! disposecfmfuncptr (pt->xOdbDelete); ! disposecfmfuncptr (pt->xOdbGetType); ! disposecfmfuncptr (pt->xOdbCountItems); ! disposecfmfuncptr (pt->xOdbGetNthItem); ! disposecfmfuncptr (pt->xOdbGetValue); ! disposecfmfuncptr (pt->xOdbSetValue); ! disposecfmfuncptr (pt->xOdbNewTable); ! disposecfmfuncptr (pt->xOdbGetModDate); ! disposecfmfuncptr (pt->xOdbDisposeValue); ! disposecfmfuncptr (pt->xOdbGetError); ! ! disposecfmfuncptr (pt->xDoScript); ! disposecfmfuncptr (pt->xDoScriptText); ! ! disposecfmfuncptr (pt->xOdbNewListValue); ! disposecfmfuncptr (pt->xOdbGetListCount); ! disposecfmfuncptr (pt->xOdbDeleteListValue); ! disposecfmfuncptr (pt->xOdbSetListValue); ! disposecfmfuncptr (pt->xOdbGetListValue); ! disposecfmfuncptr (pt->xOdbAddListValue); ! ! disposecfmfuncptr (pt->xInvoke); ! disposecfmfuncptr (pt->xCoerce); ! ! disposecfmfuncptr (pt->xCallScript); ! disposecfmfuncptr (pt->xCallScriptText); ! ! disposecfmfuncptr (pt->xThreadYield); ! disposecfmfuncptr (pt->xThreadSleep); ! ! #endif ! } /*smashcalltable*/ ! #endif *************** *** 2738,2739 **** --- 2784,2796 ---- } /*calldllverb*/ + + void dllinitverbs (void) { + + if (dllcallbacks == nil) { + + dllcallbacks = (XDLLProcTable *) malloc (sizeof (XDLLProcTable)); + + if (dllcallbacks != nil) + fillcalltable (dllcallbacks); + } + } /*initdllverbs*/ |