resource stack structure that sets up correct resource, new entry points for shared points
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -374,6 +374,11 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __DARWIN__
|
||||
// we know it's there ;-)
|
||||
WXIMPORT char std::__throws_bad_alloc ;
|
||||
#endif
|
||||
|
||||
bool wxApp::Initialize()
|
||||
{
|
||||
int error = 0 ;
|
||||
@@ -448,6 +453,7 @@ bool wxApp::Initialize()
|
||||
|
||||
if ( error )
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
short itemHit;
|
||||
Str255 message;
|
||||
|
||||
@@ -621,19 +627,76 @@ void wxApp::CleanUp()
|
||||
// wxEntry
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int wxEntryStart( int argc, char *argv[] )
|
||||
short gCurrentResource = -1 ;
|
||||
|
||||
wxStAppResource::wxStAppResource()
|
||||
{
|
||||
m_currentRefNum = CurResFile() ;
|
||||
if ( gCurrentResource != -1 )
|
||||
{
|
||||
UseResFile( gCurrentResource ) ;
|
||||
}
|
||||
}
|
||||
|
||||
wxStAppResource::~wxStAppResource()
|
||||
{
|
||||
if ( m_currentRefNum != -1 )
|
||||
{
|
||||
UseResFile( m_currentRefNum ) ;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WXMAKINGDLL
|
||||
|
||||
// for shared libraries we have to manually get the correct resource ref num upon
|
||||
// initializing and releasing when terminating, therefore the __wxinitialize and __wxterminate
|
||||
// must be used
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void __sinit(void); /* (generated by linker) */
|
||||
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
||||
pascal void __terminate(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
pascal OSErr __wxinitialize(const CFragInitBlock *theInitBlock)
|
||||
{
|
||||
gCurrentResource = -1;
|
||||
|
||||
if (theInitBlock->fragLocator.where == kDataForkCFragLocator) {
|
||||
gCurrentResource =
|
||||
FSpOpenResFile(theInitBlock->fragLocator.u.onDisk.fileSpec,
|
||||
fsRdPerm);
|
||||
}
|
||||
return __initialize( theInitBlock ) ;
|
||||
}
|
||||
|
||||
pascal void __wxterminate(void)
|
||||
{
|
||||
if (gCurrentResource != -1)
|
||||
CloseResFile(gCurrentResource);
|
||||
__terminate() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
int WXDLLEXPORT wxEntryStart( int argc, char *argv[] )
|
||||
{
|
||||
return wxApp::Initialize();
|
||||
}
|
||||
|
||||
|
||||
int wxEntryInitGui()
|
||||
int WXDLLEXPORT wxEntryInitGui()
|
||||
{
|
||||
return wxTheApp->OnInitGui();
|
||||
}
|
||||
|
||||
|
||||
void wxEntryCleanup()
|
||||
void WXDLLEXPORT wxEntryCleanup()
|
||||
{
|
||||
wxApp::CleanUp();
|
||||
}
|
||||
@@ -641,6 +704,7 @@ void wxEntryCleanup()
|
||||
|
||||
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
||||
{
|
||||
gCurrentResource = CurResFile() ;
|
||||
#ifdef __MWERKS__
|
||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||
// This seems to be necessary since there are 'rogue'
|
||||
|
@@ -374,6 +374,11 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __DARWIN__
|
||||
// we know it's there ;-)
|
||||
WXIMPORT char std::__throws_bad_alloc ;
|
||||
#endif
|
||||
|
||||
bool wxApp::Initialize()
|
||||
{
|
||||
int error = 0 ;
|
||||
@@ -448,6 +453,7 @@ bool wxApp::Initialize()
|
||||
|
||||
if ( error )
|
||||
{
|
||||
wxStAppResource resload ;
|
||||
short itemHit;
|
||||
Str255 message;
|
||||
|
||||
@@ -621,19 +627,76 @@ void wxApp::CleanUp()
|
||||
// wxEntry
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int wxEntryStart( int argc, char *argv[] )
|
||||
short gCurrentResource = -1 ;
|
||||
|
||||
wxStAppResource::wxStAppResource()
|
||||
{
|
||||
m_currentRefNum = CurResFile() ;
|
||||
if ( gCurrentResource != -1 )
|
||||
{
|
||||
UseResFile( gCurrentResource ) ;
|
||||
}
|
||||
}
|
||||
|
||||
wxStAppResource::~wxStAppResource()
|
||||
{
|
||||
if ( m_currentRefNum != -1 )
|
||||
{
|
||||
UseResFile( m_currentRefNum ) ;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WXMAKINGDLL
|
||||
|
||||
// for shared libraries we have to manually get the correct resource ref num upon
|
||||
// initializing and releasing when terminating, therefore the __wxinitialize and __wxterminate
|
||||
// must be used
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void __sinit(void); /* (generated by linker) */
|
||||
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
||||
pascal void __terminate(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
pascal OSErr __wxinitialize(const CFragInitBlock *theInitBlock)
|
||||
{
|
||||
gCurrentResource = -1;
|
||||
|
||||
if (theInitBlock->fragLocator.where == kDataForkCFragLocator) {
|
||||
gCurrentResource =
|
||||
FSpOpenResFile(theInitBlock->fragLocator.u.onDisk.fileSpec,
|
||||
fsRdPerm);
|
||||
}
|
||||
return __initialize( theInitBlock ) ;
|
||||
}
|
||||
|
||||
pascal void __wxterminate(void)
|
||||
{
|
||||
if (gCurrentResource != -1)
|
||||
CloseResFile(gCurrentResource);
|
||||
__terminate() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
int WXDLLEXPORT wxEntryStart( int argc, char *argv[] )
|
||||
{
|
||||
return wxApp::Initialize();
|
||||
}
|
||||
|
||||
|
||||
int wxEntryInitGui()
|
||||
int WXDLLEXPORT wxEntryInitGui()
|
||||
{
|
||||
return wxTheApp->OnInitGui();
|
||||
}
|
||||
|
||||
|
||||
void wxEntryCleanup()
|
||||
void WXDLLEXPORT wxEntryCleanup()
|
||||
{
|
||||
wxApp::CleanUp();
|
||||
}
|
||||
@@ -641,6 +704,7 @@ void wxEntryCleanup()
|
||||
|
||||
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
||||
{
|
||||
gCurrentResource = CurResFile() ;
|
||||
#ifdef __MWERKS__
|
||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||
// This seems to be necessary since there are 'rogue'
|
||||
|
Reference in New Issue
Block a user