modified configure to allow configuration of wxMotif under Darwin/Mac OS X
wxWindows can be configured as wxMac or wxMotif under Mac OS X replaced __WXMAC_X__ define by __DARWIN__ (general Darwin related issues) moved dlopen/dlerror code to dynlib.cpp to make it available for wxMotif git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
34
configure.in
34
configure.in
@@ -40,7 +40,7 @@ AC_DEFUN(WX_PATH_FIND_LIBRARIES,
|
|||||||
ac_find_libraries=
|
ac_find_libraries=
|
||||||
for ac_dir in $1;
|
for ac_dir in $1;
|
||||||
do
|
do
|
||||||
for ac_extension in a so sl; do
|
for ac_extension in a so sl dylib; do
|
||||||
if test -f "$ac_dir/lib$2.$ac_extension"; then
|
if test -f "$ac_dir/lib$2.$ac_extension"; then
|
||||||
ac_find_libraries=$ac_dir
|
ac_find_libraries=$ac_dir
|
||||||
break 2
|
break 2
|
||||||
@@ -393,6 +393,7 @@ USE_SUNOS=
|
|||||||
USE_ALPHA=
|
USE_ALPHA=
|
||||||
USE_OSF=
|
USE_OSF=
|
||||||
USE_BSD=
|
USE_BSD=
|
||||||
|
USE_DARWIN=
|
||||||
USE_FREEBSD=
|
USE_FREEBSD=
|
||||||
USE_OPENBSD=
|
USE_OPENBSD=
|
||||||
USE_NETBSD=
|
USE_NETBSD=
|
||||||
@@ -556,9 +557,9 @@ case "${host}" in
|
|||||||
|
|
||||||
*-*-darwin* )
|
*-*-darwin* )
|
||||||
USE_BSD=1
|
USE_BSD=1
|
||||||
USE_MAC=1
|
USE_DARWIN=1
|
||||||
AC_DEFINE(__MAC__)
|
|
||||||
AC_DEFINE(__BSD__)
|
AC_DEFINE(__BSD__)
|
||||||
|
AC_DEFINE(__DARWIN__)
|
||||||
AC_DEFINE(__UNIX__)
|
AC_DEFINE(__UNIX__)
|
||||||
DEFAULT_DEFAULT_wxUSE_MAC=1
|
DEFAULT_DEFAULT_wxUSE_MAC=1
|
||||||
;;
|
;;
|
||||||
@@ -2245,6 +2246,9 @@ if test "$wxUSE_SHARED" = "yes"; then
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-darwin* )
|
*-*-darwin* )
|
||||||
|
TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__DARWIN__ -D__POWERPC__"
|
||||||
|
CFLAGS="${CFLAGS} -fno-common"
|
||||||
|
CPPFLAGS="${CPPFLAGS} -fno-common"
|
||||||
SHARED_LD="${CXX} -dynamiclib -o"
|
SHARED_LD="${CXX} -dynamiclib -o"
|
||||||
PIC_FLAG="-dynamic -fPIC"
|
PIC_FLAG="-dynamic -fPIC"
|
||||||
if test "$wxUSE_OPENGL" = "yes"; then
|
if test "$wxUSE_OPENGL" = "yes"; then
|
||||||
@@ -2254,8 +2258,10 @@ if test "$wxUSE_SHARED" = "yes"; then
|
|||||||
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
|
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
|
||||||
WX_ALL="CREATE_LINKS"
|
WX_ALL="CREATE_LINKS"
|
||||||
fi
|
fi
|
||||||
dnl add the resources target
|
dnl add the resources target for wxMac
|
||||||
WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
|
if test "$wxUSE_MAC" = 1 ; then
|
||||||
|
WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
|
||||||
|
fi
|
||||||
dnl the name of the shared library
|
dnl the name of the shared library
|
||||||
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
|
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
|
||||||
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
|
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
|
||||||
@@ -2775,7 +2781,7 @@ if test "$USE_BEOS" = 1; then
|
|||||||
HAVE_SOME_SLEEP_FUNC=1
|
HAVE_SOME_SLEEP_FUNC=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$USE_MAC" = 1; then
|
if test "$USE_DARWIN" = 1; then
|
||||||
dnl Mac OS X has both nanosleep and usleep
|
dnl Mac OS X has both nanosleep and usleep
|
||||||
dnl but only usleep is defined in unistd.h
|
dnl but only usleep is defined in unistd.h
|
||||||
AC_DEFINE(HAVE_USLEEP)
|
AC_DEFINE(HAVE_USLEEP)
|
||||||
@@ -3055,8 +3061,8 @@ fi
|
|||||||
if test "$wxUSE_THREADS" = "yes"; then
|
if test "$wxUSE_THREADS" = "yes"; then
|
||||||
AC_DEFINE(wxUSE_THREADS)
|
AC_DEFINE(wxUSE_THREADS)
|
||||||
|
|
||||||
dnl must define _REENTRANT for multithreaded code except for Mac OS X
|
dnl must define _REENTRANT for multithreaded code except for Darwin/Mac OS X
|
||||||
if test "$wxUSE_MAC" = "0"; then
|
if test "$wxUSE_DARWIN" = "0"; then
|
||||||
CFLAGS="${CFLAGS} -D_REENTRANT"
|
CFLAGS="${CFLAGS} -D_REENTRANT"
|
||||||
CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
|
CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
|
||||||
fi
|
fi
|
||||||
@@ -3095,9 +3101,9 @@ if test "$WXWINE" = 1 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_MAC" = 1 ; then
|
if test "$wxUSE_MAC" = 1 ; then
|
||||||
TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__POWERPC__ -DTARGET_CARBON"
|
TOOLKIT_DEF="${TOOLKIT_DEF} -DTARGET_CARBON"
|
||||||
CFLAGS="${CFLAGS} -fno-common -fpascal-strings"
|
CFLAGS="${CFLAGS} -fpascal-strings"
|
||||||
CPPFLAGS="${CPPFLAGS} -cpp-precomp -fno-common -fpascal-strings"
|
CPPFLAGS="${CPPFLAGS} -cpp-precomp -fpascal-strings"
|
||||||
AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
|
AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
|
||||||
AC_CHECK_PROG(DEREZ, Derez, Derez, /Developer/Tools/Derez)
|
AC_CHECK_PROG(DEREZ, Derez, Derez, /Developer/Tools/Derez)
|
||||||
RESCOMP=${REZ}
|
RESCOMP=${REZ}
|
||||||
@@ -3765,8 +3771,8 @@ if test "$TOOLKIT" != "MSW"; then
|
|||||||
HAVE_DL_FUNCS=0
|
HAVE_DL_FUNCS=0
|
||||||
HAVE_SHL_FUNCS=0
|
HAVE_SHL_FUNCS=0
|
||||||
if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
|
if test "$wxUSE_DYNLIB_CLASS" = "yes"; then
|
||||||
if test "$USE_MAC" = 1; then
|
if test "$USE_DARWIN" = 1; then
|
||||||
dnl Mac OS X needs dl_macosx.c to be compiled in to fake dlopen/dlerror
|
dnl dlopen/dlerror is implemented in dynlib.cpp for Darwin/Mac OS X
|
||||||
HAVE_DL_FUNCS=1
|
HAVE_DL_FUNCS=1
|
||||||
else
|
else
|
||||||
dnl the test is a bit complicated because we check for dlopen() both with
|
dnl the test is a bit complicated because we check for dlopen() both with
|
||||||
@@ -4430,7 +4436,7 @@ dnl
|
|||||||
dnl note that we always link with -lm except for Mac OS X
|
dnl note that we always link with -lm except for Mac OS X
|
||||||
dnl extended.c uses floor() and is always linked in
|
dnl extended.c uses floor() and is always linked in
|
||||||
EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
|
EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
|
||||||
if test "$USE_MAC" = 1 ; then
|
if test "$wxUSE_MAC" = 1 ; then
|
||||||
EXTRA_LIBS="$EXTRA_LIBS -framework Carbon -framework System"
|
EXTRA_LIBS="$EXTRA_LIBS -framework Carbon -framework System"
|
||||||
fi
|
fi
|
||||||
if test "$wxUSE_GUI" = "yes"; then
|
if test "$wxUSE_GUI" = "yes"; then
|
||||||
|
@@ -65,6 +65,9 @@ public:
|
|||||||
|
|
||||||
// the virtual functions which may/must be overridden in the derived class
|
// the virtual functions which may/must be overridden in the derived class
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
#ifdef __DARWIN__
|
||||||
|
virtual ~wxAppBase() { }
|
||||||
|
#endif
|
||||||
|
|
||||||
// called during the program initialization, returning FALSE from here
|
// called during the program initialization, returning FALSE from here
|
||||||
// prevents the program from continuing - it's a good place to create
|
// prevents the program from continuing - it's a good place to create
|
||||||
@@ -315,11 +318,6 @@ protected:
|
|||||||
// does any of our windows has focus?
|
// does any of our windows has focus?
|
||||||
bool m_isActive;
|
bool m_isActive;
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
#ifdef __WXMAC_X__
|
|
||||||
public:
|
|
||||||
virtual ~wxAppBase() {} // Added min for Mac X
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -38,7 +38,7 @@ class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// all generic methods are in wxControlWithItems
|
// all generic methods are in wxControlWithItems
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxChoiceBase() {}
|
virtual ~wxChoiceBase() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -48,8 +48,8 @@ public:
|
|||||||
// get the control alignment (left/right/centre, top/bottom/centre)
|
// get the control alignment (left/right/centre, top/bottom/centre)
|
||||||
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
|
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
|
||||||
|
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxControlBase() { } // Added min for Mac X
|
virtual ~wxControlBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -86,8 +86,8 @@ public:
|
|||||||
int Number() const { return GetCount(); }
|
int Number() const { return GetCount(); }
|
||||||
#endif // WXWIN_COMPATIBILITY_2_2
|
#endif // WXWIN_COMPATIBILITY_2_2
|
||||||
|
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxItemContainer() {} // Added min for Mac X
|
virtual ~wxItemContainer() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -112,41 +112,26 @@
|
|||||||
#define __HPUX__
|
#define __HPUX__
|
||||||
#endif // HP-UX
|
#endif // HP-UX
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__WXMAC__) && defined(__DARWIN__)
|
||||||
// MacOS X
|
// Mac OS X
|
||||||
#ifndef __WXMAC__
|
|
||||||
#define __WXMAC__
|
// Some code has been added to workaround defects(?) in the
|
||||||
#endif
|
// bundled gcc compiler. These corrections are identified by:
|
||||||
#ifndef __WXMAC_X__
|
// __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
|
||||||
// This define really should not be necessary since __WXMAC__
|
|
||||||
// combined with __UNIX__ is sufficient to differentiate
|
|
||||||
// Classic Mac OS from Mac OS X. However, some code has been
|
|
||||||
// added to workaround defects(?) in the bundled gcc compiler
|
|
||||||
// and these corrections are identified by __WXMAC_X__
|
|
||||||
#define __WXMAC_X__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#endif // __APPLE__
|
#endif // __WXMAC__ && __DARWIN__
|
||||||
#elif defined(applec) || \
|
#elif defined(applec) || \
|
||||||
defined(THINK_C) || \
|
defined(THINK_C) || \
|
||||||
(defined(__MWERKS__) && !defined(__INTEL__))
|
(defined(__MWERKS__) && !defined(__INTEL__))
|
||||||
// MacOS
|
// MacOS
|
||||||
#elif defined(__WXMAC__) && defined(__APPLE__)
|
#elif defined(__WXMAC__) && defined(__DARWIN__)
|
||||||
// MacOS X
|
// Mac OS X
|
||||||
#define __UNIX_LIKE__
|
#define __UNIX_LIKE__
|
||||||
|
|
||||||
#ifndef __WXMAC__
|
// Some code has been added to workaround defects(?) in the
|
||||||
#define __WXMAC__
|
// bundled gcc compiler. These corrections are identified by:
|
||||||
#endif
|
// __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
|
||||||
#ifndef __WXMAC_X__
|
|
||||||
// This define really should not be necessary since __WXMAC__
|
|
||||||
// combined with __UNIX__ is sufficient to differentiate
|
|
||||||
// Classic Mac OS from Mac OS X. However, some code has been
|
|
||||||
// added to workaround defects(?) in the bundled gcc compiler
|
|
||||||
// and these corrections are identified by __WXMAC_X__
|
|
||||||
#define __WXMAC_X__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
|
@@ -22,8 +22,8 @@
|
|||||||
class WXDLLEXPORT wxDialogBase : public wxPanel
|
class WXDLLEXPORT wxDialogBase : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
~wxDialogBase() {} // Added min for Mac X
|
~wxDialogBase() { }
|
||||||
#endif
|
#endif
|
||||||
// the modal dialogs have a return code - usually the id of the last
|
// the modal dialogs have a return code - usually the id of the last
|
||||||
// pressed button
|
// pressed button
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
#elif defined(__WINDOWS__)
|
#elif defined(__WINDOWS__)
|
||||||
# include <windows.h> // needed to get HMODULE
|
# include <windows.h> // needed to get HMODULE
|
||||||
typedef HMODULE wxDllType;
|
typedef HMODULE wxDllType;
|
||||||
#elif defined(__APPLE__) && defined(__UNIX__)
|
#elif defined(__DARWIN__)
|
||||||
typedef void *wxDllType;
|
typedef void *wxDllType;
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
typedef CFragConnectionID wxDllType;
|
typedef CFragConnectionID wxDllType;
|
||||||
|
@@ -23,7 +23,7 @@ enum
|
|||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#include "wx/qt/filedlg.h"
|
#include "wx/qt/filedlg.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
#include "wx/generic/filedlgg.h"
|
#include "wx/generic/filedlgg.h"
|
||||||
#else
|
#else
|
||||||
#include "wx/mac/filedlg.h"
|
#include "wx/mac/filedlg.h"
|
||||||
|
@@ -78,8 +78,8 @@ class WXDLLEXPORT wxFontBase : public wxGDIObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// creator function
|
// creator function
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxFontBase() {} // Added min for Mac X
|
virtual ~wxFontBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// from the font components
|
// from the font components
|
||||||
|
@@ -58,8 +58,8 @@ class WXDLLEXPORT wxFrameBase : public wxWindow
|
|||||||
public:
|
public:
|
||||||
// construction
|
// construction
|
||||||
wxFrameBase();
|
wxFrameBase();
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxFrameBase() {} // Added min for Mac X
|
virtual ~wxFrameBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxFrame *New(wxWindow *parent,
|
wxFrame *New(wxWindow *parent,
|
||||||
|
@@ -31,7 +31,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
|
|||||||
class WXDLLEXPORT wxGaugeBase : public wxControl
|
class WXDLLEXPORT wxGaugeBase : public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxGaugeBase() { }
|
virtual ~wxGaugeBase() { }
|
||||||
#endif
|
#endif
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
|
@@ -31,10 +31,8 @@
|
|||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c )
|
#define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c )
|
||||||
#elif defined( __WXMAC__ )
|
#elif defined( __WXMAC__ )
|
||||||
#ifdef __WXMAC_X__
|
#ifndef __DARWIN__
|
||||||
#include <CoreServices/CoreServices.h>
|
#include "Math64.h"
|
||||||
#else
|
|
||||||
#include "Math64.h"
|
|
||||||
#endif
|
#endif
|
||||||
#define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) )
|
#define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) )
|
||||||
#else
|
#else
|
||||||
|
@@ -485,8 +485,8 @@ class WXDLLEXPORT wxList : public wxObjectList
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
|
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
~wxList() {} // Added min for Mac X
|
~wxList() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxList& operator=(const wxList& list)
|
wxList& operator=(const wxList& list)
|
||||||
|
@@ -45,8 +45,8 @@ class WXDLLEXPORT wxListBoxBase : public wxControlWithItems
|
|||||||
public:
|
public:
|
||||||
// all generic methods are in wxControlWithItems, except for the following
|
// all generic methods are in wxControlWithItems, except for the following
|
||||||
// ones which are not yet implemented by wxChoice/wxCombobox
|
// ones which are not yet implemented by wxChoice/wxCombobox
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxListBoxBase() {} // Added min for Mac X
|
virtual ~wxListBoxBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Insert(const wxString& item, int pos)
|
void Insert(const wxString& item, int pos)
|
||||||
|
@@ -101,8 +101,8 @@ class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase
|
|||||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||||
public:
|
public:
|
||||||
wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; };
|
wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; };
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxBitmapHandler() {} // Added min for Mac X
|
virtual ~wxBitmapHandler() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
||||||
|
@@ -17,13 +17,11 @@
|
|||||||
#pragma interface "checklst.h"
|
#pragma interface "checklst.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/listbox.h"
|
|
||||||
|
|
||||||
#if !defined(__MWERKS__) && !defined(__UNIX__)
|
#if !defined(__MWERKS__) && !defined(__UNIX__)
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class wxCheckListBox : public wxListBox
|
class wxCheckListBox : public wxCheckListBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||||
public:
|
public:
|
||||||
|
@@ -24,8 +24,8 @@ class wxDataObject : public wxDataObjectBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDataObject();
|
wxDataObject();
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
~wxDataObject() {} // Added min for Mac X
|
~wxDataObject() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||||
|
@@ -24,7 +24,7 @@ class wxMimeTypesManagerImpl
|
|||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxMimeTypesManagerImpl() { }
|
wxMimeTypesManagerImpl() { }
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
~wxMimeTypesManagerImpl() { }
|
~wxMimeTypesManagerImpl() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -18,9 +18,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// headers
|
// headers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
#include "wx/dynarray.h"
|
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
#include "wx/control.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// types
|
// types
|
||||||
|
@@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
class wxDataObject : public wxDataObjectBase
|
class wxDataObject : public wxDataObjectBase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
#ifdef __DARWIN__
|
||||||
|
~wxDataObject() { }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_WX_MOTIF_DATAOBJ_H_
|
#endif //_WX_MOTIF_DATAOBJ_H_
|
||||||
|
@@ -86,7 +86,7 @@ public:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__UNIX__) && !defined(__APPLE__)
|
#if defined(__UNIX__) && !defined(__WXMAC__)
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#ifndef __VMS__
|
#ifndef __VMS__
|
||||||
# include <sys/un.h>
|
# include <sys/un.h>
|
||||||
|
@@ -12,12 +12,6 @@
|
|||||||
#ifndef _WX_SPINBUTT_H_BASE_
|
#ifndef _WX_SPINBUTT_H_BASE_
|
||||||
#define _WX_SPINBUTT_H_BASE_
|
#define _WX_SPINBUTT_H_BASE_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#if !defined(__WXMOTIF__) && !defined(__WXMAC__) // because there is no matching .cpp
|
|
||||||
#pragma interface "spinbutt.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// headers
|
// headers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -30,7 +30,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
|
|||||||
class WXDLLEXPORT wxStaticBitmapBase : public wxControl
|
class WXDLLEXPORT wxStaticBitmapBase : public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
~wxStaticBitmapBase() { }
|
~wxStaticBitmapBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -49,8 +49,8 @@ public:
|
|||||||
void SetOwner(wxEvtHandler *owner, int id = -1)
|
void SetOwner(wxEvtHandler *owner, int id = -1)
|
||||||
{ m_owner = owner; m_idTimer = id; }
|
{ m_owner = owner; m_idTimer = id; }
|
||||||
|
|
||||||
#ifdef __WXMAC_X__
|
#ifdef __DARWIN__
|
||||||
virtual ~wxTimerBase() {} // Added min for Mac X
|
virtual ~wxTimerBase() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// working with the timer
|
// working with the timer
|
||||||
|
@@ -76,7 +76,13 @@
|
|||||||
else
|
else
|
||||||
return (void *)0;
|
return (void *)0;
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) && defined(__UNIX__)
|
#elif defined(__DARWIN__)
|
||||||
|
/* Porting notes:
|
||||||
|
* The dlopen port is a port from dl_next.xs by Anno Siegel.
|
||||||
|
* dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
|
||||||
|
* The method used here is just to supply the sun style dlopen etc.
|
||||||
|
* functions in terms of Darwin NS*.
|
||||||
|
*/
|
||||||
void *dlopen(const char *path, int mode /* mode is ignored */);
|
void *dlopen(const char *path, int mode /* mode is ignored */);
|
||||||
void *dlsym(void *handle, const char *symbol);
|
void *dlsym(void *handle, const char *symbol);
|
||||||
int dlclose(void *handle);
|
int dlclose(void *handle);
|
||||||
@@ -431,4 +437,100 @@ wxObject *wxLibraries::CreateObject(const wxString& path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __DARWIN__
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// For Darwin/Mac OS X
|
||||||
|
// supply the sun style dlopen functions in terms of Darwin NS*
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#import <mach-o/dyld.h>
|
||||||
|
};
|
||||||
|
|
||||||
|
enum dyldErrorSource
|
||||||
|
{
|
||||||
|
OFImage,
|
||||||
|
};
|
||||||
|
|
||||||
|
static char dl_last_error[1024];
|
||||||
|
|
||||||
|
static
|
||||||
|
void TranslateError(const char *path, enum dyldErrorSource type, int number)
|
||||||
|
{
|
||||||
|
unsigned int index;
|
||||||
|
static char *OFIErrorStrings[] =
|
||||||
|
{
|
||||||
|
"%s(%d): Object Image Load Failure\n",
|
||||||
|
"%s(%d): Object Image Load Success\n",
|
||||||
|
"%s(%d): Not an recognisable object file\n",
|
||||||
|
"%s(%d): No valid architecture\n",
|
||||||
|
"%s(%d): Object image has an invalid format\n",
|
||||||
|
"%s(%d): Invalid access (permissions?)\n",
|
||||||
|
"%s(%d): Unknown error code from NSCreateObjectFileImageFromFile\n",
|
||||||
|
};
|
||||||
|
#define NUM_OFI_ERRORS (sizeof(OFIErrorStrings) / sizeof(OFIErrorStrings[0]))
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case OFImage:
|
||||||
|
index = number;
|
||||||
|
if (index > NUM_OFI_ERRORS - 1) {
|
||||||
|
index = NUM_OFI_ERRORS - 1;
|
||||||
|
}
|
||||||
|
sprintf(dl_last_error, OFIErrorStrings[index], path, number);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
sprintf(dl_last_error, "%s(%d): Totally unknown error type %d\n",
|
||||||
|
path, number, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *dlerror()
|
||||||
|
{
|
||||||
|
return dl_last_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *dlopen(const char *path, int mode /* mode is ignored */)
|
||||||
|
{
|
||||||
|
int dyld_result;
|
||||||
|
NSObjectFileImage ofile;
|
||||||
|
NSModule handle = NULL;
|
||||||
|
|
||||||
|
dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
|
||||||
|
if (dyld_result != NSObjectFileImageSuccess)
|
||||||
|
{
|
||||||
|
TranslateError(path, OFImage, dyld_result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// NSLinkModule will cause the run to abort on any link error's
|
||||||
|
// not very friendly but the error recovery functionality is limited.
|
||||||
|
handle = NSLinkModule(ofile, path, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dlclose(void *handle) /* stub only */
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *dlsym(void *handle, const char *symbol)
|
||||||
|
{
|
||||||
|
void *addr;
|
||||||
|
|
||||||
|
if (NSIsSymbolNameDefined(symbol)) {
|
||||||
|
addr = NSAddressOfSymbol(NSLookupAndBindSymbol(symbol));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addr = NULL;
|
||||||
|
}
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __DARWIN__
|
||||||
|
|
||||||
#endif // wxUSE_DYNLIB_CLASS
|
#endif // wxUSE_DYNLIB_CLASS
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
|
#if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
|
||||||
|
|
||||||
|
#include "wx/dc.h"
|
||||||
#include "wx/print.h"
|
#include "wx/print.h"
|
||||||
#include "wx/printdlg.h"
|
#include "wx/printdlg.h"
|
||||||
#include "wx/html/htmprint.h"
|
#include "wx/html/htmprint.h"
|
||||||
|
@@ -44,7 +44,7 @@ END_EVENT_TABLE()
|
|||||||
// ----------------
|
// ----------------
|
||||||
|
|
||||||
// def ctor: use Create() to really create the control
|
// def ctor: use Create() to really create the control
|
||||||
wxCheckListBox::wxCheckListBox() : wxListBox()
|
wxCheckListBox::wxCheckListBox() : wxCheckListBoxBase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
|||||||
int nStrings, const wxString choices[],
|
int nStrings, const wxString choices[],
|
||||||
long style, const wxValidator& val,
|
long style, const wxValidator& val,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxListBox()
|
: wxCheckListBoxBase()
|
||||||
{
|
{
|
||||||
// TODO: you'll probably need a separate Create instead of using
|
// TODO: you'll probably need a separate Create instead of using
|
||||||
// the wxListBox one as here.
|
// the wxListBox one as here.
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
|
||||||
#if !defined(__UNIX__)
|
#ifndef __DARWIN__
|
||||||
#include "PLStringFuncs.h"
|
#include "PLStringFuncs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -30,13 +30,11 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
|||||||
|
|
||||||
// begin wxmac
|
// begin wxmac
|
||||||
|
|
||||||
#if defined(__UNIX__)
|
#ifndef __DARWIN__
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#else
|
|
||||||
#include <Navigation.h>
|
#include <Navigation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __UNIX__
|
#ifndef __DARWIN__
|
||||||
#include "morefile.h"
|
#include "morefile.h"
|
||||||
#include "moreextr.h"
|
#include "moreextr.h"
|
||||||
#include "fullpath.h"
|
#include "fullpath.h"
|
||||||
@@ -546,7 +544,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Boolean CrossPlatformFilterCallback (
|
pascal Boolean CrossPlatformFilterCallback (
|
||||||
AEDesc *theItem,
|
AEDesc *theItem,
|
||||||
void *info,
|
void *info,
|
||||||
void *callBackUD,
|
void *callBackUD,
|
||||||
@@ -751,7 +749,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mNavFilterUPP = NewNavObjectFilterProc( CrossPlatformFilterCallback ) ;
|
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
|
||||||
if ( m_dialogStyle & wxMULTIPLE )
|
if ( m_dialogStyle & wxMULTIPLE )
|
||||||
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
||||||
else
|
else
|
||||||
|
@@ -705,9 +705,9 @@ GENERICOBJS = \
|
|||||||
proplist.o \
|
proplist.o \
|
||||||
sashwin.o \
|
sashwin.o \
|
||||||
scrlwing.o \
|
scrlwing.o \
|
||||||
spinctlg.o \
|
|
||||||
splash.o \
|
splash.o \
|
||||||
splitter.o \
|
splitter.o \
|
||||||
|
spinctlg.o \
|
||||||
statusbr.o \
|
statusbr.o \
|
||||||
tabg.o \
|
tabg.o \
|
||||||
tbarsmpl.o \
|
tbarsmpl.o \
|
||||||
@@ -766,8 +766,8 @@ GENERICDEPS = \
|
|||||||
# Not included for Mac OS X
|
# Not included for Mac OS X
|
||||||
# dirmac.o
|
# dirmac.o
|
||||||
# filedlg.o
|
# filedlg.o
|
||||||
# statline.o
|
|
||||||
# spinctrl.o
|
# spinctrl.o
|
||||||
|
# statline.o
|
||||||
# treectrl.o
|
# treectrl.o
|
||||||
GUIOBJS = \
|
GUIOBJS = \
|
||||||
accel.o \
|
accel.o \
|
||||||
@@ -934,8 +934,7 @@ GUIDEPS = \
|
|||||||
# dialup.o
|
# dialup.o
|
||||||
UNIXOBJS = \
|
UNIXOBJS = \
|
||||||
dir.o \
|
dir.o \
|
||||||
utilsunx.o \
|
utilsunx.o
|
||||||
dl_macosx.o
|
|
||||||
|
|
||||||
UNIXDEPS = \
|
UNIXDEPS = \
|
||||||
dialup.d \
|
dialup.d \
|
||||||
@@ -945,8 +944,7 @@ UNIXDEPS = \
|
|||||||
gsocket.d \
|
gsocket.d \
|
||||||
mimetype.d \
|
mimetype.d \
|
||||||
threadpsx.d \
|
threadpsx.d \
|
||||||
utilsunx.d \
|
utilsunx.d
|
||||||
dl_macosx.d
|
|
||||||
|
|
||||||
HTMLOBJS = \
|
HTMLOBJS = \
|
||||||
helpctrl.o \
|
helpctrl.o \
|
||||||
|
@@ -44,7 +44,7 @@ END_EVENT_TABLE()
|
|||||||
// ----------------
|
// ----------------
|
||||||
|
|
||||||
// def ctor: use Create() to really create the control
|
// def ctor: use Create() to really create the control
|
||||||
wxCheckListBox::wxCheckListBox() : wxListBox()
|
wxCheckListBox::wxCheckListBox() : wxCheckListBoxBase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
|
|||||||
int nStrings, const wxString choices[],
|
int nStrings, const wxString choices[],
|
||||||
long style, const wxValidator& val,
|
long style, const wxValidator& val,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxListBox()
|
: wxCheckListBoxBase()
|
||||||
{
|
{
|
||||||
// TODO: you'll probably need a separate Create instead of using
|
// TODO: you'll probably need a separate Create instead of using
|
||||||
// the wxListBox one as here.
|
// the wxListBox one as here.
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
|
||||||
#if !defined(__UNIX__)
|
#ifndef __DARWIN__
|
||||||
#include "PLStringFuncs.h"
|
#include "PLStringFuncs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -30,13 +30,11 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
|||||||
|
|
||||||
// begin wxmac
|
// begin wxmac
|
||||||
|
|
||||||
#if defined(__UNIX__)
|
#ifndef __DARWIN__
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#else
|
|
||||||
#include <Navigation.h>
|
#include <Navigation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __UNIX__
|
#ifndef __DARWIN__
|
||||||
#include "morefile.h"
|
#include "morefile.h"
|
||||||
#include "moreextr.h"
|
#include "moreextr.h"
|
||||||
#include "fullpath.h"
|
#include "fullpath.h"
|
||||||
@@ -546,7 +544,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Boolean CrossPlatformFilterCallback (
|
pascal Boolean CrossPlatformFilterCallback (
|
||||||
AEDesc *theItem,
|
AEDesc *theItem,
|
||||||
void *info,
|
void *info,
|
||||||
void *callBackUD,
|
void *callBackUD,
|
||||||
@@ -751,7 +749,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mNavFilterUPP = NewNavObjectFilterProc( CrossPlatformFilterCallback ) ;
|
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
|
||||||
if ( m_dialogStyle & wxMULTIPLE )
|
if ( m_dialogStyle & wxMULTIPLE )
|
||||||
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
||||||
else
|
else
|
||||||
|
@@ -705,9 +705,9 @@ GENERICOBJS = \
|
|||||||
proplist.o \
|
proplist.o \
|
||||||
sashwin.o \
|
sashwin.o \
|
||||||
scrlwing.o \
|
scrlwing.o \
|
||||||
spinctlg.o \
|
|
||||||
splash.o \
|
splash.o \
|
||||||
splitter.o \
|
splitter.o \
|
||||||
|
spinctlg.o \
|
||||||
statusbr.o \
|
statusbr.o \
|
||||||
tabg.o \
|
tabg.o \
|
||||||
tbarsmpl.o \
|
tbarsmpl.o \
|
||||||
@@ -766,8 +766,8 @@ GENERICDEPS = \
|
|||||||
# Not included for Mac OS X
|
# Not included for Mac OS X
|
||||||
# dirmac.o
|
# dirmac.o
|
||||||
# filedlg.o
|
# filedlg.o
|
||||||
# statline.o
|
|
||||||
# spinctrl.o
|
# spinctrl.o
|
||||||
|
# statline.o
|
||||||
# treectrl.o
|
# treectrl.o
|
||||||
GUIOBJS = \
|
GUIOBJS = \
|
||||||
accel.o \
|
accel.o \
|
||||||
@@ -934,8 +934,7 @@ GUIDEPS = \
|
|||||||
# dialup.o
|
# dialup.o
|
||||||
UNIXOBJS = \
|
UNIXOBJS = \
|
||||||
dir.o \
|
dir.o \
|
||||||
utilsunx.o \
|
utilsunx.o
|
||||||
dl_macosx.o
|
|
||||||
|
|
||||||
UNIXDEPS = \
|
UNIXDEPS = \
|
||||||
dialup.d \
|
dialup.d \
|
||||||
@@ -945,8 +944,7 @@ UNIXDEPS = \
|
|||||||
gsocket.d \
|
gsocket.d \
|
||||||
mimetype.d \
|
mimetype.d \
|
||||||
threadpsx.d \
|
threadpsx.d \
|
||||||
utilsunx.d \
|
utilsunx.d
|
||||||
dl_macosx.d
|
|
||||||
|
|
||||||
HTMLOBJS = \
|
HTMLOBJS = \
|
||||||
helpctrl.o \
|
helpctrl.o \
|
||||||
|
BIN
src/makemac.mcp
BIN
src/makemac.mcp
Binary file not shown.
@@ -10,8 +10,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "spinbutt.h"
|
#pragma implementation "spinbutt.h"
|
||||||
#pragma implementation "spinctlg.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
|
@@ -1,104 +0,0 @@
|
|||||||
/* dl_macosx.c
|
|
||||||
*
|
|
||||||
* Platform: Mac OS X
|
|
||||||
* Author: Gilles Depeyrot (Gilles.Depeyrot@wanadoo.fr)
|
|
||||||
* Based on: dl_next.xs by Anno Siegel (siegel@zrz.TU-Berlin.DE)
|
|
||||||
* Based on: dl_dlopen.xs by Paul Marquess
|
|
||||||
* Created: Aug 15th, 1994
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Porting notes:
|
|
||||||
* dl_macosx.c is itself a port from dl_next.xs by Anno Siegel.
|
|
||||||
* dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
|
|
||||||
* The method used here is just to supply the sun style dlopen etc.
|
|
||||||
* functions in terms of NeXTs rld_*.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static char dl_last_error[1024];
|
|
||||||
|
|
||||||
char *dlerror()
|
|
||||||
{
|
|
||||||
return dl_last_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dlclose(void *handle) /* stub only */
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#import <mach-o/dyld.h>
|
|
||||||
};
|
|
||||||
|
|
||||||
enum dyldErrorSource
|
|
||||||
{
|
|
||||||
OFImage,
|
|
||||||
};
|
|
||||||
|
|
||||||
static
|
|
||||||
void TranslateError(const char *path, enum dyldErrorSource type, int number)
|
|
||||||
{
|
|
||||||
unsigned int index;
|
|
||||||
static char *OFIErrorStrings[] =
|
|
||||||
{
|
|
||||||
"%s(%d): Object Image Load Failure\n",
|
|
||||||
"%s(%d): Object Image Load Success\n",
|
|
||||||
"%s(%d): Not an recognisable object file\n",
|
|
||||||
"%s(%d): No valid architecture\n",
|
|
||||||
"%s(%d): Object image has an invalid format\n",
|
|
||||||
"%s(%d): Invalid access (permissions?)\n",
|
|
||||||
"%s(%d): Unknown error code from NSCreateObjectFileImageFromFile\n",
|
|
||||||
};
|
|
||||||
#define NUM_OFI_ERRORS (sizeof(OFIErrorStrings) / sizeof(OFIErrorStrings[0]))
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case OFImage:
|
|
||||||
index = number;
|
|
||||||
if (index > NUM_OFI_ERRORS - 1)
|
|
||||||
index = NUM_OFI_ERRORS - 1;
|
|
||||||
sprintf(dl_last_error, OFIErrorStrings[index], path, number);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
sprintf(dl_last_error, "%s(%d): Totally unknown error type %d\n",
|
|
||||||
path, number, type);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *dlopen(const char *path, int mode /* mode is ignored */)
|
|
||||||
{
|
|
||||||
int dyld_result;
|
|
||||||
NSObjectFileImage ofile;
|
|
||||||
NSModule handle = NULL;
|
|
||||||
|
|
||||||
dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
|
|
||||||
if (dyld_result != NSObjectFileImageSuccess)
|
|
||||||
{
|
|
||||||
TranslateError(path, OFImage, dyld_result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// NSLinkModule will cause the run to abort on any link error's
|
|
||||||
// not very friendly but the error recovery functionality is limited.
|
|
||||||
handle = NSLinkModule(ofile, path, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *dlsym(void *handle, const char *symbol)
|
|
||||||
{
|
|
||||||
void *addr;
|
|
||||||
|
|
||||||
if (NSIsSymbolNameDefined(symbol))
|
|
||||||
addr = NSAddressOfSymbol(NSLookupAndBindSymbol(symbol));
|
|
||||||
else
|
|
||||||
addr = NULL;
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
}
|
|
Reference in New Issue
Block a user