예제 #1
0
//-------------------------------------------------------------------------------
//
//	PluginMain
//	
//	All calls to the plug in module come through this routine.
//
//	Inputs:
//		const int16 selector		Host provides selector indicating what
//									command to do.
//
//	Inputs and Outputs:
//		FilterRecord *filterRecord	Host provides a pointer to parameter block
//									containing pertinent data and callbacks.
//									See PIFilter.h
//
//		intptr_t *data				Use this to store a handle or pointer to our global
//									data structure, which is maintained by the
//									host between calls to the plug in.
//
//	Outputs:
//		int16 *result				Returns error result. Some errors are handled
//									by the host, some are silent, and some you
//									must handle. See PIGeneral.h.
//
//-------------------------------------------------------------------------------
DLLExport MACPASCAL void PluginMain(const int16 selector,
								    FilterRecordPtr filterRecord,
								    intptr_t * data,
								    int16 * result)
{
	// update our global parameters
	gFilterRecord = filterRecord;
	gDataHandle = data;
	gResult = result;

	if (selector == filterSelectorAbout)
	{
		sSPBasic = ((AboutRecord*)gFilterRecord)->sSPBasic;
	}
	else
	{
		sSPBasic = gFilterRecord->sSPBasic;

		if (gFilterRecord->bigDocumentData != NULL)
			gFilterRecord->bigDocumentData->PluginUsing32BitCoordinates = true;
	}

	// do the command according to the selector
	switch (selector)
	{
		case filterSelectorAbout:
			DoAbout();
			break;
		case filterSelectorParameters:
			DoParameters();
			break;
		case filterSelectorPrepare:
			DoPrepare();
			break;
		case filterSelectorStart:
			DoStart();
			break;
		case filterSelectorContinue:
			DoContinue();
			break;
		case filterSelectorFinish:
			DoFinish();
			break;
		default:
			break;
	}
	
	// unlock our handles used by gData and gParams
	if (selector != filterSelectorAbout)
		UnlockHandles();
}
예제 #2
0
void XDebugManager::OnDebugStartOrContinue(clDebugEvent& e)
{
    if ( !PHPWorkspace::Get()->IsOpen() ) {
        e.Skip();
        return;
    }
    
    // a PHP debug session requested to start
    if ( !m_readerThread ) {
        // starting the debugger
        DoStartDebugger();
        
    } else {
        DoContinue();
    }
}
예제 #3
0
DLLExport SPAPI void PluginMain(const int16 selector,
								FilterRecordPtr filterRecord,
								intptr_t * data,
								int16 * result)
{
	gData = data;
	gResult = result;
	
	if (selector == filterSelectorAbout)
	{
		sSPBasic = ((AboutRecordPtr)filterRecord)->sSPBasic;
	} 
	else 
	{
		gFilterRecord = filterRecord;
		sSPBasic = gFilterRecord->sSPBasic;

		if (gFilterRecord->bigDocumentData != NULL)
			gFilterRecord->bigDocumentData->PluginUsing32BitCoordinates = true;
	}

	switch (selector)
	{
		case filterSelectorAbout:
			DoAbout();
			break;
		case filterSelectorParameters:
			DoParameters();
			break;
		case filterSelectorPrepare:
			DoPrepare();
			break;
		case filterSelectorStart:
			DoStart();
			break;
		case filterSelectorContinue:
			DoContinue();
			break;
		case filterSelectorFinish:
			DoFinish();
			break;
		default:
			*gResult = filterBadParameters;
			break;
	}
}
예제 #4
0
bool XDebugManager::ProcessDebuggerMessage(const wxString& buffer )
{
    if ( buffer.IsEmpty() )
        return false;
    
    CL_DEBUG( "XDebug <<< " + buffer );
    
    wxXmlDocument doc;
    wxStringInputStream sis(buffer);
    if ( !doc.Load( sis ) ) {
        // failed to parse XML
        CL_DEBUG( "CodeLite >>> invalid XML!");
        return false;
    }
    
    wxXmlNode *root = doc.GetRoot();
    
    if ( root->GetName() == "init" ) {
        
        // Parse the content and notify codelite to open the main file
        xInitStruct initData = ParseInitXML( root );
        
        // Negotiate features with the IDE
        DoNegotiateFeatures();
        
        // this is a startup message from the debugger
        DoApplyBreakpoints();
        
        // Issue a "Continue" command
        DoContinue();
        
    } else if ( root->GetName() == "response" ) {
        // Handle response
        DoHandleResponse(root);
    }
    return true;
}
예제 #5
0
DLLExport MACPASCAL void PluginMain (const int16 selector,
						             FilterRecordPtr filterParamBlock,
						             intptr_t *data,
						             int16 *result)
{
	//---------------------------------------------------------------------------
	//	(1) Check for about box request.
	//
	// 	The about box is a special request; the parameter block is not filled
	// 	out, none of the callbacks or standard data is available.  Instead,
	// 	the parameter block points to an AboutRecord, which is used
	// 	on Windows.
	//---------------------------------------------------------------------------

	if (selector == filterSelectorAbout)
	{
		sSPBasic = ((AboutRecordPtr)filterParamBlock)->sSPBasic;
		DoAbout((AboutRecordPtr)filterParamBlock);
	}
	else
	{ // do the rest of the process as normal:

		sSPBasic = ((FilterRecordPtr)filterParamBlock)->sSPBasic;

		Ptr globalPtr = NULL;		// Pointer for global structure
		GPtr globals = NULL; 		// actual globals

		//-----------------------------------------------------------------------
		//	(2) Allocate and initalize globals.
		//
		// 	AllocateGlobals requires the pointer to result, the pointer to the
		// 	parameter block, a pointer to the handle procs, the size of our local
		// 	"Globals" structure, a pointer to the long *data, a Function
		// 	Proc (FProcP) to the InitGlobals routine.  It automatically sets-up,
		// 	initializes the globals (if necessary), results result to 0, and
		// 	returns with a valid pointer to the locked globals handle or NULL.
		//-----------------------------------------------------------------------
		
		globalPtr = AllocateGlobals (result,
									 filterParamBlock,
									 filterParamBlock->handleProcs,
									 sizeof(Globals),
						 			 data,
						 			 InitGlobals);
		
		if (globalPtr == NULL)
		{ // Something bad happened if we couldn't allocate our pointer.
		  // Fortunately, everything's already been cleaned up,
		  // so all we have to do is report an error.
		  
		  *result = memFullErr;
		  return;
		}
		
		// Get our "globals" variable assigned as a Global Pointer struct with the
		// data we've returned:
		globals = (GPtr)globalPtr;

		//-----------------------------------------------------------------------
		//	(3) Dispatch selector.
		//-----------------------------------------------------------------------

		switch (selector)
		{
			case filterSelectorParameters:
				DoParameters(globals);
				break;
			case filterSelectorPrepare:
				DoPrepare(globals);
				break;
			case filterSelectorStart:
				DoStart(globals);
				break;
			case filterSelectorContinue:
				DoContinue(globals);
				break;
			case filterSelectorFinish:
				DoFinish(globals);
				break;
		}
	
		//-----------------------------------------------------------------------
		//	(4) Unlock data, and exit resource.
		//
		//	Result is automatically returned in *result, which is
		//	pointed to by gResult.
		//-----------------------------------------------------------------------	
		
		// unlock handle pointing to parameter block and data so it can move
		// if memory gets shuffled:
		if (*data != 0 /* NULL */ )
			PIUnlockHandle((Handle)*data);
	
	} // about selector special		
	
} // end PluginMain
//--------------------------------------------------------------------------------
bool CSystemMonitorHandlerThread::DoCommand()
	{
	ASSERT(NUM_OF_CMDS == sizeof(g_pCommands) / sizeof(LPCTSTR));

	bool bRv = true;

	m_sCurCmd.MakeLower();
	m_sCurCmd.TrimLeft();
	m_sCurCmd.TrimRight();

	TRY
		{
		CString sTemp(m_sCurCmd.Left(4));

		if(sTemp == "hey")
			m_socket.Send("there\r\n\r\n", 6, CSmallSocket::WAITFORWOULDBLOCK);
		else
			{
			for(int i = 0; i < NUM_OF_CMDS; i++)
				{
				if(strncmp(sTemp, g_pCommands[i], 4) == 0)
					break;
				}

			if(i == CMDEXIT)
				{
				m_sCurCmd.Empty();
				m_sUser.Empty();
				m_sPass.Empty();
				return false;
				}

			if(i == CMDUSER)
				{
				if(m_sCurCmd.GetLength() > 5)
					DoUser(m_sCurCmd.Mid(5));
				m_sCurCmd.Empty();
				return true;
				}

			if(i == CMDPASS)
				{
				if(m_sCurCmd.GetLength() > 5)
					DoPass(m_sCurCmd.Mid(5));
				m_sCurCmd.Empty();
				return true;
				}

			if(! m_bLoggedIn)
				{
				m_sCurCmd.Empty();
				return true;
				}

			switch(i)
				{
				case CMDLOAD:
					if(m_sCurCmd.GetLength() > 5)
						DoLoad(m_sCurCmd.Mid(5));
					else
						{
						CSSConfigGeneral config;
						DoLoad(config.m_sLicenseFileDefault);
						}
					break;
				case CMDLIST:
					DoList();
					break;
				case CMDPAUSE:
					DoPause();
					break;
				case CMDCONT:
					DoContinue();
					break;
				case CMDREVOKE:
					DoRevoke();
					break;
				case CMDHELP:
					{
					for(int i = 0; i < NUM_OF_CMDS; i++)
						{
						CString sTemp;
						sTemp.Format("%s\r\n", g_pCommands[i]);
						m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
						}
					}
					break;
				case CMDSERIAL:
					{
					CString sTemp;
					for(int i = 0; CPlatformInfo::GetProcessorSerialNumber(sTemp, i); i++)
						{
						sTemp += "\r\n";
						m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
						}
					}
					break;

				case CMDDONGLE:
					DoDongle();
					break;

				case CMDCONFIG:
					DoConfigDump();
					break;

				default:
					m_socket.Send("what?\r\n\r\n", 6, CSmallSocket::WAITFORWOULDBLOCK);
					break;
				}
			}
		}
	CATCH_ALL(e)
		{
		}
	END_CATCH_ALL

	m_sCurCmd.Empty();
	return bRv;
	}