]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/utils.cpp
Document the cfstring.h/cfstring.cpp as being used by all Darwin ports (it's
[wxWidgets.git] / src / mac / carbon / utils.cpp
index e38a3074340e3cf3f4f5c77599d4993f5d9dcbb0..ae1ef930d579862799b4d5127f60685dd2d62cde 100644 (file)
@@ -65,7 +65,7 @@
 #include "wx/mac/private.h"
 
 #if defined(__MWERKS__) && wxUSE_UNICODE
-#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
+#if __MWERKS__ < 0x4100
     #include <wtime.h>
 #endif
 #endif
@@ -91,281 +91,12 @@ wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn)
 #endif
 }
 
-// ----------------------------------------------------------------------------
-// debugging support
-// ----------------------------------------------------------------------------
-
-#if defined(__WXDEBUG__) && defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
-
-// MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds...
-
-#ifndef __MetroNubUtils__
-#include "MetroNubUtils.h"
-#endif
-
-#ifndef __GESTALT__
-#include <Gestalt.h>
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-#include <CodeFragments.h>
-
-extern "C" long CallUniversalProc(UniversalProcPtr theProcPtr, ProcInfoType procInfo, ...);
-
-ProcPtr gCallUniversalProc_Proc = NULL;
-
-#endif
-
-static MetroNubUserEntryBlock*    gMetroNubEntry = NULL;
-
-static long fRunOnce = false;
-
-
-Boolean IsMetroNubInstalled()
-{
-    if (!fRunOnce)
-    {
-        long result, value;
-
-        fRunOnce = true;
-        gMetroNubEntry = NULL;
-
-        if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
-        {
-            // look for MetroNub's Gestalt selector
-            if (Gestalt(kMetroNubUserSignature, &result) == noErr)
-            {
-#if TARGET_API_MAC_CARBON
-                if (gCallUniversalProc_Proc == NULL)
-                {
-                    CFragConnectionID   connectionID;
-                    Ptr                 mainAddress;
-                    Str255              errorString;
-                    ProcPtr             symbolAddress;
-                    OSErr               err;
-                    CFragSymbolClass    symbolClass;
-
-                    symbolAddress = NULL;
-                    err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
-                                           &connectionID, &mainAddress, errorString);
-
-                    if (err != noErr)
-                    {
-                        gCallUniversalProc_Proc = NULL;
-                        goto end;
-                    }
-
-                    err = FindSymbol(connectionID, "\pCallUniversalProc",
-                                    (Ptr *) &gCallUniversalProc_Proc, &symbolClass);
-
-                    if (err != noErr)
-                    {
-                        gCallUniversalProc_Proc = NULL;
-                        goto end;
-                    }
-                }
-#endif
-
-                {
-                    MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
-
-                    // make sure the version of the API is compatible
-                    if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
-                        kMetroNubUserAPIVersion <= block->apiHiVersion)
-                    {
-                        // success!
-                        gMetroNubEntry = block;
-                    }
-                }
-            }
-        }
-    }
-
-end:
-
-#if TARGET_API_MAC_CARBON
-    return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
-#else
-    return (gMetroNubEntry != NULL);
-#endif
-}
-
-Boolean IsMWDebuggerRunning()
-{
-    if (IsMetroNubInstalled())
-        return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
-
-    return false;
-}
-
-Boolean AmIBeingMWDebugged()
-{
-    if (IsMetroNubInstalled())
-        return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
-
-    return false;
-}
-
 extern bool WXDLLEXPORT wxIsDebuggerRunning()
 {
-    return IsMWDebuggerRunning() && AmIBeingMWDebugged();
-}
-
-#else
-
-extern bool WXDLLEXPORT wxIsDebuggerRunning()
-{
-    return false;
-}
-
-#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400)
-
-
-#ifndef __DARWIN__
-// defined in unix/utilsunx.cpp for Mac OS X
-
-// get full hostname (with domain name if possible)
-bool wxGetFullHostName(wxChar *buf, int maxSize)
-{
-    return wxGetHostName(buf, maxSize);
-}
-
-// Get user ID e.g. jacs
-bool wxGetUserId(wxChar *buf, int maxSize)
-{
-    return wxGetUserName( buf , maxSize );
-}
-
-const wxChar* wxGetHomeDir(wxString *pstr)
-{
-    *pstr = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder );
-    return pstr->c_str();
-}
-
-// Get hostname only (without domain name)
-bool wxGetHostName(wxChar *buf, int maxSize)
-{
-    // Gets Chooser name of user by examining a System resource.
-    buf[0] = 0;
-
-    const short kComputerNameID = -16413;
-
-    short oldResFile = CurResFile();
-    UseResFile(0);
-    StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
-    UseResFile(oldResFile);
-
-    if (chooserName && *chooserName)
-    {
-        HLock( (Handle) chooserName );
-        wxString name = wxMacMakeStringFromPascal( *chooserName );
-        HUnlock( (Handle) chooserName );
-        ReleaseResource( (Handle) chooserName );
-        wxStrncpy( buf , name , maxSize - 1 );
-    }
-
-    return true;
-}
-
-// Get user name e.g. Stefan Csomor
-bool wxGetUserName(wxChar *buf, int maxSize)
-{
-    // Gets Chooser name of user by examining a System resource.
-    buf[0] = 0;
-
-    const short kChooserNameID = -16096;
-
-    short oldResFile = CurResFile();
-    UseResFile(0);
-    StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
-    UseResFile(oldResFile);
-
-    if (chooserName && *chooserName)
-    {
-        HLock( (Handle) chooserName );
-        wxString name = wxMacMakeStringFromPascal( *chooserName );
-        HUnlock( (Handle) chooserName );
-        ReleaseResource( (Handle) chooserName );
-        wxStrncpy( buf , name , maxSize - 1 );
-    }
-
-    return true;
-}
-
-int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
-{
-    // TODO
-    return 0;
-}
-
-WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
-{
-    // TODO : under classic there is no environement support, under X yes
-    return false;
-}
-
-// set the env var name to the given value, return true on success
-WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxString& value)
-{
-    // TODO : under classic there is no environement support, under X yes
-    return false;
-}
-
-WXDLLEXPORT bool wxUnsetEnv(const wxString& var)
-{
-    // TODO : under classic there is no environement support, under X yes
+    // TODO : try to find out ...
     return false;
 }
 
-// Execute a program in an Interactive Shell
-bool wxShell(const wxString& command)
-{
-    // TODO
-    return false;
-}
-
-// Shutdown or reboot the PC
-bool wxShutdown(wxShutdownFlags wFlags)
-{
-    // TODO
-    return false;
-}
-
-// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
-wxMemorySize wxGetFreeMemory()
-{
-    return (wxMemorySize)FreeMem();
-}
-
-#ifndef __DARWIN__
-
-void wxMicroSleep(unsigned long microseconds)
-{
-    AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime());
-    MPDelayUntil( & wakeup);
-}
-
-void wxMilliSleep(unsigned long milliseconds)
-{
-    AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime());
-    MPDelayUntil( & wakeup);
-}
-
-void wxSleep(int nSecs)
-{
-    wxMilliSleep(1000*nSecs);
-}
-
-#endif
-
-// Consume all events until no more left
-void wxFlushEvents()
-{
-}
-
-#endif // !__DARWIN__
-
 // Emit a beeeeeep
 void wxBell()
 {