Ejemplo n.º 1
0
bool wxCINT::Init()
{
	m_bInit = (G__init_cint(wxT("cint")) != G__INIT_CINT_FAILURE);

	// add our extension to the list of the available for loading extensions:
	wxScriptFile::m_strFileExt[wxCINT_SCRIPTFILE] = wxT("CXX");

	return m_bInit;
}
Ejemplo n.º 2
0
DWORD WINAPI CCintocxCtrl::CintThread(LPVOID lpvThreadParm)
{
   DWORD dwResult=0;
   int flag=1;
   G__value result;
   int iresult;
   char arg[G__LONGLINE];
   CCintocxCtrl *origin;
   EVENTID eid;

#ifndef WIN32EVENT
   CSingleLock WaitForCintEvent(&CintEvent);
#else
   CintEvent = CreateEvent(NULL,FALSE,FALSE,"CintEvent");
#endif

   while(flag) {
      // Wait for event from GUI thread
      IsBusy=0;
#ifndef WIN32EVENT
      WaitForCintEvent.Lock(INFINITE);
#else
      WaitForSingleObject(CintEvent,INFINITE);
#endif
      IsBusy=1;

      while(0==EventQue.Pop(arg,&origin,&eid)) {
        switch(eid) {
        case INITEVENT:
	  // start cint with specified argument
	  iresult=G__init_cint(arg);  
	  sprintf(arg,"%d",iresult); 
	  origin->m_result = arg;
	  break;
        case EVALEVENT:
	  // start cint with default if not started already
	  if(!G__getcintready()) iresult=G__init_cint("cint");  
	  // evaluate scheduled expression
	  result=G__calc(arg);
	  // translate return value to string
	  value2string(arg,&result);
	  origin->m_result = arg;
	  break;
        case TERMINATEEVENT:
	  // terminate cint and kill thread
	  G__scratch_all();
	  goto terminate_thread;
        }
	// notify evaldone to GUI thread
        origin->FireEvalDone();
      }
   } // while(flag)

terminate_thread:
   IsBusy=0;
   IsCintThreadActive = 0 ;
#ifndef WIN32EVENT
   WaitForCintEvent.Unlock(3);
#else
   CloseHandle(CintEvent);
#endif

   G__FreeConsole();
   
   return(dwResult);   
}