/* static */ PyObject *PyIActiveScript::InterruptScriptThread(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	int id;
	PyObject *obExcepInfo;
	int flags;
	if ( !PyArg_ParseTuple(args, "iOi:InterruptScriptThread", &id, &obExcepInfo, &flags) )
		return NULL;

	IActiveScript *pIAS = GetI(self);
	if ( pIAS == NULL )
		return NULL;

	EXCEPINFO excepInfo;
	memset(&excepInfo, 0, sizeof excepInfo);
	if ( !PyCom_ExcepInfoFromPyObject(obExcepInfo, &excepInfo) )
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pIAS->InterruptScriptThread((SCRIPTTHREADID)id, &excepInfo, (DWORD)flags);
	SysFreeString(excepInfo.bstrSource);
	SysFreeString(excepInfo.bstrDescription);
	SysFreeString(excepInfo.bstrHelpFile);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self, hr);

	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod |PyIDebugApplication|FireDebuggerEvent|Fire a generic event to the IApplicationDebugger (if any)
PyObject *PyIDebugApplication::FireDebuggerEvent(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIIID>|guid||A GUID.
	// @pyparm <o PyIUnknown>|unknown||An unknown object.
	PyObject *obguid, *obunk;
	if ( !PyArg_ParseTuple(args, "OO:FireDebuggerEvent", &obguid, &obunk) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	IUnknown *punk;
	IID iid;
	if (!PyWinObject_AsIID(obguid, &iid))
		 bPythonIsHappy = FALSE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obunk, IID_IUnknown, (void **)&punk, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->FireDebuggerEvent( iid, punk );
	punk->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
Beispiel #3
0
// @pymethod |PyIDebugDocumentText|GetPositionOfContext|Description of GetPositionOfContext.
PyObject *PyIDebugDocumentText::GetPositionOfContext(PyObject *self, PyObject *args)
{
	IDebugDocumentText *pIDDT = GetI(self);
	if ( pIDDT == NULL )
		return NULL;
	// @pyparm <o PyIDebugDocumentContext>|psc||Description for psc
	PyObject *obpsc;
	IDebugDocumentContext *psc;
	ULONG pcCharacterPosition;
	ULONG cNumChars;
	if ( !PyArg_ParseTuple(args, "O:GetPositionOfContext", &obpsc) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsc, IID_IDebugDocumentContext, (void **)&psc, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDDT->GetPositionOfContext( psc, &pcCharacterPosition, &cNumChars );
	psc->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("ii", pcCharacterPosition, cNumChars);
	return pyretval;
}
// @pymethod int|PyIActiveScriptSite|GetItemInfo|
PyObject *PyIActiveScriptSite::GetItemInfo(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obName;
	int mask;
	IActiveScriptSite *pMySite = GetI(self);
	if (pMySite==NULL) return NULL;
	if (!PyArg_ParseTuple(args, "Oi:GetItemInfo", &obName, &mask))
		return NULL;
	OLECHAR *name;
	if (!PyWinObject_AsWCHAR(obName, &name))
		return NULL;
	IUnknown *punk = NULL;
	ITypeInfo *ptype = NULL;

	PY_INTERFACE_PRECALL;
	SCODE sc = pMySite->GetItemInfo(name, mask, &punk, &ptype);
	PY_INTERFACE_POSTCALL;
	PyWinObject_FreeWCHAR(name);
	if (FAILED(sc))
		return SetPythonCOMError(self, sc);
	PyObject *obDispatch = PyCom_PyObjectFromIUnknown(punk, IID_IUnknown);
	PyObject *obType = PyCom_PyObjectFromIUnknown(ptype, IID_ITypeInfo);
	PyObject *rc = NULL;
	if (obDispatch && obType)
		rc = Py_BuildValue("OO", obDispatch, obType);
	Py_XDECREF(obDispatch);
	Py_XDECREF(obType);
	return rc;
}
// @pymethod |PyIDebugApplication|SynchronousCallInDebuggerThread|Provides a mechanism for the caller to run code in the debugger thread.
PyObject *PyIDebugApplication::SynchronousCallInDebuggerThread(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm This is generally  
	// used so that language engines and hosts can implement free threaded objects on top  
	// of their single threaded implementations.
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugThreadCall>|pptc||Description for pptc
	// @pyparm int|dwParam1||Description for dwParam1
	// @pyparm int|dwParam2||Description for dwParam2
	// @pyparm int|dwParam3||Description for dwParam3
	PyObject *obpptc;
	IDebugThreadCall *pptc;
	DWORD dwParam1;
	DWORD dwParam2;
	DWORD dwParam3;
	if ( !PyArg_ParseTuple(args, "Oiii:SynchronousCallInDebuggerThread", &obpptc, &dwParam1, &dwParam2, &dwParam3) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpptc, IID_IDebugThreadCall, (void **)&pptc, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->SynchronousCallInDebuggerThread( pptc, dwParam1, dwParam2, dwParam3 );
	pptc->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod int|PyIDebugApplication|HandleBreakPoint|Called by the language engine in the context of a thread that has hit a breakpoint.
PyObject *PyIDebugApplication::HandleBreakPoint(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm This method causes the current thread to block and a notification of the breakpoint  
	// to be sent to the debugger IDE. When the debugger IDE resumes the application this  
	// method returns with the action to be taken.  
	//  
	// Note: While in the breakpoint the language engine may be called in this thread to do  
	// various things such as enumerating stack frames or evaluating expressions.  

	// @rdesc The result is the break resume action - one of the BREAKRESUMEACTION contsants.

	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm int|br||Break reason - one of the BREAKREASON_* constants.
	BREAKREASON br;
	BREAKRESUMEACTION pbra;
	if ( !PyArg_ParseTuple(args, "i:HandleBreakPoint", &br) )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->HandleBreakPoint( br, &pbra );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("i", pbra);
	return pyretval;
}
// @pymethod |PyIDebugApplication|DebugOutput|Causes the given string to be displayed by the debugger IDE, normally in an output window.
PyObject *PyIDebugApplication::DebugOutput(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm  This mechanism provides the means for a language engine to implement language  
	// specific debugging output support. Example: Debug.writeln("Help") in JavaScript.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o unicode>|pstr||Description for pstr
	PyObject *obpstr;
	BSTR pstr;
	if ( !PyArg_ParseTuple(args, "O:DebugOutput", &obpstr) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_BstrFromPyObject(obpstr, &pstr)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->DebugOutput( pstr );
	PY_INTERFACE_POSTCALL;
	if (pstr) SysFreeString(pstr);
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
/* static */ PyObject *PyIActiveScript::GetScriptDispatch(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obItemName = Py_None;
	if ( !PyArg_ParseTuple(args, "|O:GetScriptDispatch", &obItemName) )
		return NULL;

	IActiveScript *pIAS = GetI(self);
	if ( pIAS == NULL )
		return NULL;

	BSTR pstrItemName = NULL;
	if (!PyWinObject_AsBstr(obItemName, &pstrItemName, TRUE))
		return NULL;

	IDispatch *pdisp;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIAS->GetScriptDispatch(pstrItemName, &pdisp);
	PY_INTERFACE_POSTCALL;
	PyWinObject_FreeBstr(pstrItemName);
	if ( FAILED(hr) )
		return SetPythonCOMError(self, hr);

	if ( !pdisp )
	{
		Py_INCREF(Py_None);
		return Py_None;
	}

	return PyCom_PyObjectFromIUnknown((IUnknown *)pdisp, IID_IDispatch, FALSE);
}
Beispiel #9
0
// @pymethod |PyIMachineDebugManager|AddApplication|Description of AddApplication.
PyObject *PyIMachineDebugManager::AddApplication(PyObject *self, PyObject *args)
{
	IMachineDebugManager *pIMDM = GetI(self);
	if ( pIMDM == NULL )
		return NULL;
	// @pyparm <o PyIRemoteDebugApplication>|pda||Description for pda
	PyObject *obpda;
	if ( !PyArg_ParseTuple(args, "O:AddApplication", &obpda) )
		return NULL;
	IRemoteDebugApplication *pda;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpda, IID_IRemoteDebugApplication, (void **)&pda, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	DWORD dwAppCookie;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIMDM->AddApplication( pda, &dwAppCookie );
	pda->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("i", dwAppCookie);
	return pyretval;
}
/* static */ PyObject *PyIActiveScript::AddTypeLib(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obiid;
	int major;
	int minor;
	int flags;
	if ( !PyArg_ParseTuple(args, "Oiii:AddTypeLib", &obiid, &major, &minor, &flags) )
		return NULL;

	CLSID libiid;
	if ( !PyWinObject_AsIID(obiid, &libiid) )
		return NULL;

	IActiveScript *pIAS = GetI(self);
	if ( pIAS == NULL )
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pIAS->AddTypeLib(libiid, (DWORD)major, (DWORD)minor, (DWORD)flags);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self, hr);

	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod |PyIDebugApplication|CreateAsyncDebugOperation|Creates an IDebugAsyncOperation object to wrap a provided <o PyIDebugSyncOperation> object.
PyObject *PyIDebugApplication::CreateAsyncDebugOperation(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm This provides a mechanism for language engines to implement asynchronous expression and 
	// evaluation, etc. without having to know the details of synchronization with the 
	// debugger thread. See the descriptions for <o PyIDebugSyncOperation> and <o PyIDebugAsyncOperation> 
	// for more details.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugSyncOperation>|psdo||Description for psdo
	PyObject *obpsdo;
	IDebugSyncOperation *psdo;
	IDebugAsyncOperation *ppado;
	if ( !PyArg_ParseTuple(args, "O:CreateAsyncDebugOperation", &obpsdo) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsdo, IID_IDebugSyncOperation, (void **)&psdo, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->CreateAsyncDebugOperation( psdo, &ppado );
	psdo->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppado, IID_IDebugAsyncOperation, FALSE);
}
// @pymethod |PyIActiveScriptDebug|GetScriptletTextAttributes|Description of GetScriptletTextAttributes.
PyObject *PyIActiveScriptDebug::GetScriptletTextAttributes(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IActiveScriptDebug *pIASD = GetI(self);
	if ( pIASD == NULL )
		return NULL;
	// @pyparm string|pstrCode||The script block text.
	// @pyparm string|pstrDelimiter||See <om PyIActiveScriptParse::ParseScriptText> for a description of this argument.
	// @pyparm int|dwFlags||See <om PyIActiveScriptParse::ParseScriptText> for a description of this argument.
	DWORD dwFlags;
	PyObject *obCode, *obDelim;
	if ( !PyArg_ParseTuple(args, "OOi:GetScriptletTextAttributes", &obCode, &obDelim, &dwFlags) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	WCHAR *pstrDelimiter;
	BSTR bstr;
	if (!PyWinObject_AsWCHAR(obDelim, &pstrDelimiter)) bPythonIsHappy = FALSE;
	if (!PyCom_BstrFromPyObject(obCode, &bstr)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	ULONG uNumCodeChars = SysStringLen(bstr);
	SOURCE_TEXT_ATTR *pattr = new SOURCE_TEXT_ATTR[uNumCodeChars];
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIASD->GetScriptletTextAttributes( bstr, uNumCodeChars, pstrDelimiter, dwFlags, pattr );
	PY_INTERFACE_POSTCALL;
	SysFreeString(bstr);
	PyWinObject_FreeWCHAR(pstrDelimiter);
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	return PyAXDebug_PyObject_FromSOURCE_TEXT_ATTR(pattr, uNumCodeChars);
}
// @pymethod int|PyIDebugApplication|AddStackFrameSniffer|Adds a stack frame sniffer to this application.
PyObject *PyIDebugApplication::AddStackFrameSniffer(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm Generally called by a language engine  
	// to expose its stack frames to the debugger. It is possible for other entities to  
	// expose stack frames.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugStackFrameSniffer>|pdsfs||Description for pdsfs
	PyObject *obpdsfs;
	IDebugStackFrameSniffer *pdsfs;
	DWORD pdwCookie;
	if ( !PyArg_ParseTuple(args, "O:AddStackFrameSniffer", &obpdsfs) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpdsfs, IID_IDebugStackFrameSniffer, (void **)&pdsfs, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->AddStackFrameSniffer( pdsfs, &pdwCookie );
	pdsfs->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("i", pdwCookie);
	return pyretval;
	// @rdesc The result is an integer cookie, to be passed to <om PyIDebugApplication.RemoveStackFrameSniffer>
}
// @pymethod |PyIDebugApplication|SetName|Sets the name of the application.
PyObject *PyIDebugApplication::SetName(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm The provided name will be returned in subsequent calls  
	// to >om PyIRemoteDebugApplication.GetName>.
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o unicode>|pstrName||The name of the application.
	PyObject *obpstrName;
	BSTR pstrName;
	if ( !PyArg_ParseTuple(args, "O:SetName", &obpstrName) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_BstrFromPyObject(obpstrName, &pstrName)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->SetName( pstrName );
	PY_INTERFACE_POSTCALL;
	if (pstrName) SysFreeString(pstrName);
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod int|PyIConnectionPoint|Advise|Establishes a connection between the connection point object and the client's sink.
PyObject *PyIConnectionPoint::Advise(PyObject *self, PyObject *args)
{
	PyObject *obUnk;
	// @pyparm <o PyIUnknown>|unk||The client's advise sink
	if ( !PyArg_ParseTuple(args, "O:Advise", &obUnk) )
		return NULL;

	IUnknown *pUnk;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&pUnk, FALSE))
		return NULL;

	IConnectionPoint *pICP = GetI(self);
	if ( pICP == NULL )
		return NULL;

	DWORD cookie;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pICP->Advise( pUnk, &cookie );
	pUnk->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	// @rdesc The result is the connection point identifier used by <om PyIConnectionPoint::Unadvise>
	return PyInt_FromLong(cookie);
}
// @pymethod int|PyIActiveScriptSite|OnScriptTerminate|
PyObject *PyIActiveScriptSite::OnScriptTerminate(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obResult, *obException;
	if (!PyArg_ParseTuple(args, "OO:OnScriptTerminate", &obResult, &obException))
		return NULL;

	IActiveScriptSite *pMySite = GetI(self);
	if (pMySite==NULL) return NULL;

	VARIANT varResult;
	VARIANT *pVarResult = NULL;
	if (obResult!=Py_None) {
		pVarResult = &varResult;
		VariantInit(&varResult);
		if (!PyCom_VariantFromPyObject(obResult, pVarResult))
			return NULL;
	}
	EXCEPINFO excep;
	EXCEPINFO *pExcep = NULL;
	if (obException!=Py_None) {
		pExcep = &excep;
		memset(pExcep, 0, sizeof(EXCEPINFO));
		if (!PyCom_ExcepInfoFromPyObject(obException, pExcep))
			return NULL;
	}
	PY_INTERFACE_PRECALL;
	SCODE sc = pMySite->OnScriptTerminate(pVarResult, pExcep);
	PY_INTERFACE_POSTCALL;
	if (pVarResult)
		VariantClear(pVarResult);
	if (FAILED(sc))
		return SetPythonCOMError(self, sc);
	return PyInt_FromLong(sc);
}
// @pymethod object|PyIEnumDebugStackFrames|Next|Retrieves a specified number of items in the enumeration sequence.
PyObject *PyIEnumDebugStackFrames::Next(PyObject *self, PyObject *args)
{
	long celt = 1;
	// @pyparm int|num|1|Number of items to retrieve.
	if ( !PyArg_ParseTuple(args, "|l:Next", &celt) )
		return NULL;

	IEnumDebugStackFrames *pIEDebugStackFrames = GetI(self);
	if ( pIEDebugStackFrames == NULL )
		return NULL;

	DebugStackFrameDescriptor *rgVar = new DebugStackFrameDescriptor [celt];
	if ( rgVar == NULL ) {
		PyErr_SetString(PyExc_MemoryError, "allocating result IDebugStackFrameDescriptor");
		return NULL;
	}

	int i;
/*	for ( i = celt; i--; )
		// *** possibly init each structure element???
*/

	ULONG celtFetched = 0;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIEDebugStackFrames->Next(celt, rgVar, &celtFetched);
	PY_INTERFACE_POSTCALL;
	if (  HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) )
	{
		delete [] rgVar;
		return SetPythonCOMError(self,hr);
	}

	PyObject *result = PyTuple_New(celtFetched);
	if ( result != NULL )
	{
		for ( i = celtFetched; i--; )
		{
			// Make a result tuple.
			PyObject *obFrame = PyCom_PyObjectFromIUnknown(rgVar[i].pdsf, IID_IDebugStackFrame, FALSE);
			rgVar[i].pdsf = NULL;
			if ( obFrame == NULL)
			{
				Py_DECREF(result);
				result = NULL;
				break;
			}
			PyObject *obUnkFinal = PyCom_PyObjectFromIUnknown(rgVar[i].punkFinal, IID_IUnknown, TRUE);
			PyTuple_SET_ITEM(result, i, Py_BuildValue("OiiiO", obFrame, rgVar[i].dwMin, rgVar[i].dwLim, rgVar[i].fFinal, obUnkFinal));
			Py_DECREF(obFrame);
			Py_XDECREF(obUnkFinal);
		}
	}
	for ( i = celtFetched; i--; ) PYCOM_RELEASE(rgVar[i].pdsf);
	delete [] rgVar;
	return result;
}
Beispiel #18
0
// @pymethod object|PyIEnumRemoteDebugApplications|Next|Retrieves a specified number of items in the enumeration sequence.
PyObject *PyIEnumRemoteDebugApplications::Next(PyObject *self, PyObject *args)
{
	long celt = 1;
	// @pyparm int|num|1|Number of items to retrieve.
	if ( !PyArg_ParseTuple(args, "|l:Next", &celt) )
		return NULL;

	IEnumRemoteDebugApplications *pIERemoteDebugApplications = GetI(self);
	if ( pIERemoteDebugApplications == NULL )
		return NULL;

	IRemoteDebugApplication **rgVar = new IRemoteDebugApplication *[celt];
	if ( rgVar == NULL ) {
		PyErr_SetString(PyExc_MemoryError, "allocating result IRemoteDebugApplications");
		return NULL;
	}

	int i;
/*	for ( i = celt; i--; )
		// *** possibly init each structure element???
*/

	ULONG celtFetched = 0;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIERemoteDebugApplications->Next(celt, rgVar, &celtFetched);
	PY_INTERFACE_POSTCALL;
	if (  HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) )
	{
		delete [] rgVar;
		return SetPythonCOMError(self,hr);
	}

	PyObject *result = PyTuple_New(celtFetched);
	if ( result != NULL )
	{
		for ( i = celtFetched; i--; )
		{

			PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_IRemoteDebugApplication, FALSE);
			if ( ob == NULL )
			{
				Py_DECREF(result);
				result = NULL;
				break;
			}
			PyTuple_SET_ITEM(result, i, ob);
		}
	}

/*	for ( i = celtFetched; i--; )
		// *** possibly cleanup each structure element???
*/
	delete [] rgVar;
	return result;
}
/* static */ PyObject *PyIActiveScript::SetScriptSite(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	PyObject *obSite;
	if ( !PyArg_ParseTuple(args, "O:SetScriptSite", &obSite) )
		return NULL;

	IActiveScript *pIAS = GetI(self);
	if ( pIAS == NULL )
		return NULL;

	if ( !PyIBase::is_object(obSite, &PyIUnknown::type) )
	{
		PyErr_SetString(PyExc_ValueError, "argument is not a site");
		return NULL;
	}
	IUnknown *punk = PyIUnknown::GetI(obSite);
	if ( !punk )
		return NULL;	/* exception was set by GetI() */
	/* note: we don't explicitly hold a reference to punk */

	IActiveScriptSite *pIASS;
	HRESULT hr;
	Py_BEGIN_ALLOW_THREADS
	hr = punk->QueryInterface(IID_IActiveScriptSite, (LPVOID*)&pIASS);
	Py_END_ALLOW_THREADS
	if ( FAILED(hr) )
		return SetPythonCOMError(self, hr);

	PY_INTERFACE_PRECALL;
	hr = pIAS->SetScriptSite(pIASS);
	pIASS->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self, hr);

	Py_INCREF(Py_None);
	return Py_None;
}
Beispiel #20
0
// @pymethod |PyIDebugStackFrame|GetCodeContext|Returns the current code context associated with the stack frame.
PyObject *PyIDebugStackFrame::GetCodeContext(PyObject *self, PyObject *args)
{
	IDebugStackFrame *pIDSF = GetI(self);
	if ( pIDSF == NULL )
		return NULL;
	IDebugCodeContext *ppcc;
	if ( !PyArg_ParseTuple(args, ":GetCodeContext") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDSF->GetCodeContext( &ppcc );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppcc, IID_IDebugCodeContext, FALSE);
}
Beispiel #21
0
// @pymethod <o PyIDebugApplicationThread>|PyIDebugStackFrame|GetThread|Returns the thread associated with this stack frame.
PyObject *PyIDebugStackFrame::GetThread(PyObject *self, PyObject *args)
{
	IDebugStackFrame *pIDSF = GetI(self);
	if ( pIDSF == NULL )
		return NULL;
	IDebugApplicationThread *ppat;
	if ( !PyArg_ParseTuple(args, ":GetThread") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDSF->GetThread( &ppat );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppat, IID_IDebugApplicationThread, FALSE);
}
Beispiel #22
0
// @pymethod <o PyIDebugProperty>|PyIDebugStackFrame|GetDebugProperty|Returns the debug property.
PyObject *PyIDebugStackFrame::GetDebugProperty(PyObject *self, PyObject *args)
{
	IDebugStackFrame *pIDSF = GetI(self);
	if ( pIDSF == NULL )
		return NULL;
	IDebugProperty *ppdp;
	if ( !PyArg_ParseTuple(args, ":GetDebugProperty") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDSF->GetDebugProperty( &ppdp );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppdp, IID_IDebugProperty, FALSE);
}
Beispiel #23
0
// @pymethod |PyIDispatchEx|DeleteMemberByDispID|
PyObject *PyIDispatchEx::DeleteMemberByDispID(PyObject *self, PyObject *args)
{
	long dispid;
	if (!PyArg_ParseTuple(args, "ll:DeleteMemberByDispID",
		&dispid)) // @pyparm int|dispid||
		return NULL;
	IDispatchEx *pMyDispatchEx = GetI(self);
	if (pMyDispatchEx==NULL) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pMyDispatchEx->DeleteMemberByDispID((DISPID)dispid);
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr)) return SetPythonCOMError(self, hr);
	Py_INCREF(Py_None);
	return Py_None;
}
Beispiel #24
0
// @pymethod str|PyIDispatchEx|GetMemberName|Returns the name associated with a member id
PyObject *PyIDispatchEx::GetMemberName(PyObject *self, PyObject *args)
{
	long dispid;
	BSTR name;
	if (!PyArg_ParseTuple(args, "l:GetMemberName",
		&dispid)) // @pyparm int|dispid||The member id
		return NULL;
	IDispatchEx *pMyDispatchEx = GetI(self);
	if (pMyDispatchEx==NULL) return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pMyDispatchEx->GetMemberName(dispid, &name);
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr)) return SetPythonCOMError(self, hr);
	return PyWinObject_FromBstr(name, TRUE);
}
Beispiel #25
0
// @pymethod |PyIDebugExpression|QueryIsComplete|Description of QueryIsComplete.
PyObject *PyIDebugExpression::QueryIsComplete(PyObject *self, PyObject *args)
{
	IDebugExpression *pIDE = GetI(self);
	if ( pIDE == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":QueryIsComplete") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDE->QueryIsComplete( );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;

}
// @pymethod <o PyIDebugApplicationThread>|PyIDebugApplication|GetCurrentThread|Returns the application thread object associated with the currently running thread.
PyObject *PyIDebugApplication::GetCurrentThread(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	IDebugApplicationThread *pat;
	if ( !PyArg_ParseTuple(args, ":GetCurrentThread") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->GetCurrentThread( &pat );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(pat, IID_IDebugApplicationThread, FALSE);
}
// @pymethod |PyIActiveScriptSiteDebug|GetRootApplicationNode|Description of GetRootApplicationNode.
PyObject *PyIActiveScriptSiteDebug::GetRootApplicationNode(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IActiveScriptSiteDebug *pIASSD = GetI(self);
	if ( pIASSD == NULL )
		return NULL;
	IDebugApplicationNode *ppdan;
	if ( !PyArg_ParseTuple(args, ":GetRootApplicationNode") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIASSD->GetRootApplicationNode( &ppdan );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppdan, IID_IDebugApplicationNode, FALSE);
}
// @pymethod int|PyIActiveScriptSite|GetLCID|
PyObject *PyIActiveScriptSite::GetLCID(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	if (!PyArg_ParseTuple(args, ":GetLCID"))
		return NULL;

	IActiveScriptSite *pMySite = GetI(self);
	if (pMySite==NULL) return NULL;
	unsigned long lcid;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMySite->GetLCID(&lcid);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return SetPythonCOMError(self, sc);
	return PyInt_FromLong(lcid);
}
// @pymethod |PyIDebugApplication|Close|Causes this application to release all references and enter a zombie state.
PyObject *PyIDebugApplication::Close(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm  Called by the owner of the application generally on shut down.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":Close") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->Close( );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod |PyIDebugApplication|QueryCurrentThreadIsDebuggerThread|Determines if the current running thread is the debugger thread. 
PyObject *PyIDebugApplication::QueryCurrentThreadIsDebuggerThread(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":QueryCurrentThreadIsDebuggerThread") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->QueryCurrentThreadIsDebuggerThread( );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyInt_FromLong(hr);
	// @rdesc Returns S_OK if the current running thread is the debugger thread.  
	// Otherwise, returns S_FALSE.
}