<commit_before>#include "wrapper.h"

extern int APPTerminating;


#ifdef _WIN32

#if (defined(__WXDEBUG__) && defined(_MSC_VER))
 #include <crtdbg.h>
#endif

#include <windows.h>


extern "C"
{

EWXWEXPORT(void, ELJApp_InitializeC) (wxClosure* closure, int _argc, char** _argv)
{
  WXHINSTANCE wxhInstance = GetModuleHandle(NULL);

/* check memory leaks with visual C++ */
#if (defined(__WXDEBUG__) && defined(_MSC_VER))
  _CrtMemState memStart,memEnd,memDif;
  _CrtMemCheckpoint( &memStart );
  _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
  _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
  _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
#endif

  initClosure = closure;
  APPTerminating = 0;
  wxEntry(wxhInstance, NULL, (_argc > 0 ? _argv[0] : NULL), SW_SHOWNORMAL, true);
  APPTerminating = 1;

  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */

/* check memory leaks with visual C++ */
#if (defined(__WXDEBUG__) && defined(_MSC_VER))
  _CrtMemCheckpoint( &memEnd );
  if (_CrtMemDifference( &memDif, &memStart, &memEnd)
     && (memDif.lCounts[_NORMAL_BLOCK]>=-2 && memDif.lCounts[_NORMAL_BLOCK] <= 0))
  {
    _RPT0(_CRT_WARN,"\n** memory leak detected **\n" );
    _CrtMemDumpStatistics(&memDif);
    _CrtMemDumpAllObjectsSince(&memStart);
    _RPT0(_CRT_WARN,"** memory leak report done **\n\n" );

  }
#endif

}

EWXWEXPORT(void, ELJApp_initialize)(void* _obj, AppInitFunc _func, char* _cmd, void* _inst)
{
  WXHINSTANCE wxhInstance = _inst;
  APPTerminating = 0;
  wxEntry(wxhInstance, NULL, _cmd, SW_SHOWNORMAL, true);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */
}

}

#else  /* not WIN32 */

#ifdef __WXMAC__ /* declare wxEntry explicitly as wxMAC seems to leave it out? */
void wxEntry( int argc, char** argv, bool enterLoop = true );
#endif
extern "C"
{

EWXWEXPORT(void, ELJApp_InitializeC) (wxClosure* closure, int _argc, char** _argv)
{
  char* args[] = { "wxc", NULL };

  initClosure = closure;
  if (_argv == NULL) {
    /* note: wxGTK crashes when argv == NULL */
    _argv = args;
    _argc = 1;
  }
  APPTerminating = 0;
  wxEntry(_argc,_argv);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  wxPendingEvents = NULL;
}

EWXWEXPORT(void, ELJApp_initialize) (void* _obj, AppInitFunc _func, int _argc, void* _argv)
{
  APPTerminating = 0;
  wxEntry(_argc, (char**)_argv);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  wxPendingEvents = NULL;
}

}
#endif<commit_msg>[wxhaskell-from-cvs @ 2003-07-13 23:00:22 by dleijen]<commit_after>#include "wrapper.h"

extern int APPTerminating;


#ifdef _WIN32

#if (defined(__WXDEBUG__) && defined(_MSC_VER))
 #include <crtdbg.h>
#endif

#include <windows.h>


extern "C"
{

EWXWEXPORT(void, ELJApp_InitializeC) (wxClosure* closure, int _argc, char** _argv)
{
  WXHINSTANCE wxhInstance = GetModuleHandle(NULL);

/* check memory leaks with visual C++ */
#if (defined(__WXDEBUG__) && defined(_MSC_VER))
  _CrtMemState memStart,memEnd,memDif;
  _CrtMemCheckpoint( &memStart );
  _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
  _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
  _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
  _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
#endif

  initClosure = closure;
  APPTerminating = 0;
  wxEntry(wxhInstance, NULL, (_argc > 0 ? _argv[0] : NULL), SW_SHOWNORMAL, true);
  APPTerminating = 1;

  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */

#if defined(_MSC_VER)
  wxPendingEvents = NULL; 
#endif

/* check memory leaks with visual C++ */
#if (defined(__WXDEBUG__) && defined(_MSC_VER))
  _CrtMemCheckpoint( &memEnd );
  if (_CrtMemDifference( &memDif, &memStart, &memEnd)
     && (memDif.lCounts[_NORMAL_BLOCK]>=-2 && memDif.lCounts[_NORMAL_BLOCK] <= 0))
  {
    _RPT0(_CRT_WARN,"\n** memory leak detected **\n" );
    _CrtMemDumpStatistics(&memDif);
    _CrtMemDumpAllObjectsSince(&memStart);
    _RPT0(_CRT_WARN,"** memory leak report done **\n\n" );

  }
#endif

}

EWXWEXPORT(void, ELJApp_initialize)(void* _obj, AppInitFunc _func, char* _cmd, void* _inst)
{
  WXHINSTANCE wxhInstance = _inst;
  APPTerminating = 0;
  wxEntry(wxhInstance, NULL, _cmd, SW_SHOWNORMAL, true);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */
}

}

#else  /* not WIN32 */

#ifdef __WXMAC__ /* declare wxEntry explicitly as wxMAC seems to leave it out? */
void wxEntry( int argc, char** argv, bool enterLoop = true );
#endif
extern "C"
{

EWXWEXPORT(void, ELJApp_InitializeC) (wxClosure* closure, int _argc, char** _argv)
{
  char* args[] = { "wxc", NULL };

  initClosure = closure;
  if (_argv == NULL) {
    /* note: wxGTK crashes when argv == NULL */
    _argv = args;
    _argc = 1;
  }
  APPTerminating = 0;
  wxEntry(_argc,_argv);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */
}

EWXWEXPORT(void, ELJApp_initialize) (void* _obj, AppInitFunc _func, int _argc, void* _argv)
{
  APPTerminating = 0;
  wxEntry(_argc, (char**)_argv);
  APPTerminating = 1;
  /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */
  /* wxPendingEvents = NULL; */
}

}
#endif
{'fraction_non_alphanumeric': 0.12405573275138493, 'fraction_numerical': 0.008729226120530469, 'mean_word_length': 4.537174721189591, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5733655', 'n_tokens_mistral': 2293, 'n_tokens_neox': 2198, 'n_words': 544}