5#include "Stroika/Foundation/StroikaPreComp.h" 
    7#if qStroika_Foundation_Common_Platform_MacOS 
   10#include <UDrawingState.h>  
   11#include <UMemoryMgr.h>     
   12#elif qStroika_FeatureSupported_XWindows 
   22#include "LedItApplication.h" 
   27#if qStroika_Foundation_Common_Platform_MacOS 
   35#elif qStroika_FeatureSupported_XWindows 
   36#define qSlowXDebugSyncMode 0 
   38#ifndef qUseMyXErrorHandlers 
   39#define qUseMyXErrorHandlers qStroika_Foundation_Debug_AssertionsChecked 
   44using namespace Stroika::Frameworks::Led;
 
   45using namespace Stroika::Frameworks::Led::Platform;
 
   50#if qStroika_Foundation_Common_Platform_MacOS 
   52#if qProfile && defined(__MWERKS__) 
   56#if qUseMacTmpMemForAllocs 
   57inline char* DoSysAlloc (
size_t n)
 
   60    gDebugNewFlags &= ~dnCheckBlocksInApplZone;
 
   63    Handle h = ::TempNewHandle (n, &err); 
 
   68            Handle x = ::NewHandle (4 * 1024);
 
   84inline void DoSysFree (
void* p)
 
   86    Handle h = ::RecoverHandle (
reinterpret_cast<Ptr
> (p));
 
   90inline size_t DoGetPtrSize (
void* p)
 
   92    Handle h = ::RecoverHandle (
reinterpret_cast<Ptr
> (p));
 
   93    return ::GetHandleSize (h);
 
   97#if qUseMacTmpMemForAllocs 
  105#include "pool_alloc.h" 
  107void* __sys_alloc (std::size_t n)
 
  109    return DoSysAlloc (n);
 
  111void __sys_free (
void* p)
 
  115std::size_t __sys_pointer_size (
void* p)
 
  117    return ::DoGetPtrSize (p);
 
  123#define NEWMODE NEWMODE_MALLOC 
  124#include "DebugNew.cp" 
  130using namespace Stroika::Frameworks::Led;
 
  132#if qStroika_FeatureSupported_XWindows && qUseMyXErrorHandlers 
  133static int MyXErrorHandler (Display* display, XErrorEvent* error)
 
  135    if (error->error_code) {
 
  136        if (gdk_error_warnings) {
 
  138            XGetErrorText (display, error->error_code, buf, 63);
 
  139            g_error (
"%s\n  serial %ld error_code %d request_code %d minor_code %d\n", buf, error->serial, error->error_code,
 
  140                     error->request_code, error->minor_code);
 
  142        gdk_error_code = error->error_code;
 
  148#if qStroika_Foundation_Common_Platform_MacOS || qStroika_FeatureSupported_XWindows 
  149int main ([[maybe_unused]]
int argc, [maybe_unused]]
char** argv)
 
  151#if qStroika_Foundation_Common_Platform_MacOS 
  154        SetDebugThrow_ (debugAction_Alert);
 
  155        SetDebugSignal_ (debugAction_Alert);
 
  159    const long kMinStack = 32l * 1024l; 
 
  160    ::SetApplLimit ((Ptr)((
long)(::GetApplLimit ())-kMinStack));
 
  166    ::InitializeHeap (3);
 
  169    UQDGlobals::InitializeToolbox ();
 
  171#if qProfile && defined(__MWERKS__) 
  172    OSErr proErr = ::ProfilerInit (collectDetailed, bestTimeBase, 10000, 1000);
 
  175    LedItApplication theApp; 
 
  178#if qProfile && defined(__MWERKS__) 
  179    ::ProfilerDump (
"\pLedProfile.prof");
 
  183#if DEBUG_NEW > 0 && DEBUG_NEW >= DEBUG_NEW_LEAKS 
  185    ::DebugNewValidateAllBlocks ();
 
  187#elif qStroika_FeatureSupported_XWindows 
  189    gtk_init (&argc, &argv);
 
  190#if qUseMyXErrorHandlers 
  191    XSetErrorHandler (MyXErrorHandler);
 
  194#if qSlowXDebugSyncMode 
  195    (void)XSynchronize (GDK_DISPLAY (), 
true);
 
  198    LedItApplication app;
 
#define qStroika_Foundation_Debug_AssertionsChecked
The qStroika_Foundation_Debug_AssertionsChecked flag determines if assertions are checked and validat...