// @pymethod |PyIOleObject|SetHostNames|Description of SetHostNames. PyObject *PyIOleObject::SetHostNames(PyObject *self, PyObject *args) { IOleObject *pIOO = GetI(self); if ( pIOO == NULL ) return NULL; // @pyparm <o unicode>|szContainerApp||Description for szContainerApp // @pyparm <o unicode>|szContainerObj||Description for szContainerObj PyObject *obszContainerApp; PyObject *obszContainerObj; LPOLESTR szContainerApp; LPOLESTR szContainerObj; if ( !PyArg_ParseTuple(args, "OO:SetHostNames", &obszContainerApp, &obszContainerObj) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obszContainerApp, &szContainerApp)) bPythonIsHappy = FALSE; if (!PyCom_BstrFromPyObject(obszContainerObj, &szContainerObj)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIOO->SetHostNames( szContainerApp, szContainerObj ); PY_INTERFACE_POSTCALL; SysFreeString(szContainerApp); SysFreeString(szContainerObj); if ( FAILED(hr) ) return OleSetOleError(hr); Py_INCREF(Py_None); return Py_None; }
// @pymethod |PyIActiveScriptParseProcedure|ParseProcedureText|Description of ParseProcedureText. PyObject *PyIActiveScriptParseProcedure::ParseProcedureText(PyObject *self, PyObject *args) { IActiveScriptParseProcedure *pIASPP = GetI(self); if ( pIASPP == NULL ) return NULL; // @pyparm <o unicode>|pstrCode||Description for pstrCode // @pyparm <o unicode>|pstrFormalParams||Description for pstrFormalParams // @pyparm <o unicode>|pstrProcedureName||Description for pstrProcedureName // @pyparm <o unicode>|pstrItemName||Description for pstrItemName // @pyparm <o PyIUnknown>|punkContext||Description for punkContext // @pyparm <o unicode>|pstrDelimiter||Description for pstrDelimiter // @pyparm int|dwSourceContextCookie||Description for dwSourceContextCookie // @pyparm int|ulStartingLineNumber||Description for ulStartingLineNumber // @pyparm int|dwFlags||Description for dwFlags PyObject *obpstrCode; PyObject *obpstrFormalParams; PyObject *obpstrProcedureName; PyObject *obpstrItemName; PyObject *obpunkContext; PyObject *obpstrDelimiter; LPOLESTR pstrCode; LPOLESTR pstrFormalParams; LPOLESTR pstrProcedureName; LPOLESTR pstrItemName; IUnknown * punkContext; LPOLESTR pstrDelimiter; DWORD dwSourceContextCookie; ULONG ulStartingLineNumber; DWORD dwFlags; IDispatch * ppdisp; if ( !PyArg_ParseTuple(args, "OOOOOOiii:ParseProcedureText", &obpstrCode, &obpstrFormalParams, &obpstrProcedureName, &obpstrItemName, &obpunkContext, &obpstrDelimiter, &dwSourceContextCookie, &ulStartingLineNumber, &dwFlags) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obpstrCode, &pstrCode)) bPythonIsHappy = FALSE; if (!PyCom_BstrFromPyObject(obpstrFormalParams, &pstrFormalParams)) bPythonIsHappy = FALSE; if (!PyCom_BstrFromPyObject(obpstrProcedureName, &pstrProcedureName)) bPythonIsHappy = FALSE; if (!PyCom_BstrFromPyObject(obpstrItemName, &pstrItemName)) bPythonIsHappy = FALSE; if (!PyCom_InterfaceFromPyInstanceOrObject(obpunkContext, IID_IUnknown, (void **)&punkContext, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!PyCom_BstrFromPyObject(obpstrDelimiter, &pstrDelimiter)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIASPP->ParseProcedureText( pstrCode, pstrFormalParams, pstrProcedureName, pstrItemName, punkContext, pstrDelimiter, dwSourceContextCookie, ulStartingLineNumber, dwFlags, &ppdisp ); if (punkContext) punkContext->Release(); PY_INTERFACE_POSTCALL; SysFreeString(pstrCode); SysFreeString(pstrFormalParams); SysFreeString(pstrProcedureName); SysFreeString(pstrItemName); SysFreeString(pstrDelimiter); if ( FAILED(hr) ) return PyCom_BuildPyException(hr); return PyCom_PyObjectFromIUnknown(ppdisp, IID_IDispatch, FALSE); }
// @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; }
// @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; }
STDMETHODIMP PyGDebugDocumentText::GetText( /* [in] */ ULONG cCharacterPosition, /* [size_is][length_is][out][in] */ WCHAR __RPC_FAR * pcharText, /* [size_is][length_is][out][in] */ SOURCE_TEXT_ATTR __RPC_FAR * pstaTextAttr, /* [out][in] */ ULONG __RPC_FAR * pcNumChars, /* [in] */ ULONG cMaxChars) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetText", &result, "iii", cCharacterPosition, cMaxChars, (pstaTextAttr!=NULL)); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obText, *obAttr; if (!PyArg_ParseTuple(result, "OO" , &obText, &obAttr)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BSTR bstr; BOOL ok = TRUE; ok = PyCom_BstrFromPyObject(obText, &bstr); if (ok) { *pcNumChars = SysStringLen(bstr); wcsncpy(pcharText, bstr, *pcNumChars); SysFreeString(bstr); } if (ok && pstaTextAttr) { ok = PyAXDebug_PyObject_AsSOURCE_TEXT_ATTR(obAttr, pstaTextAttr, *pcNumChars); } Py_DECREF(result); if (!ok) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); return hr; }
// @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 |PyIDebugDocumentTextAuthor|ReplaceText|Description of ReplaceText. PyObject *PyIDebugDocumentTextAuthor::ReplaceText(PyObject *self, PyObject *args) { IDebugDocumentTextAuthor *pIDDTA = GetI(self); if ( pIDDTA == NULL ) return NULL; // @pyparm int|cCharacterPosition||Description for cCharacterPosition // @pyparm int|cNumToReplace||Description for cNumToReplace // @pyparm <o unicode>|pcharText||Description for pcharText PyObject *obpcharText; ULONG cCharacterPosition; ULONG cNumToReplace; BSTR pcharText; if ( !PyArg_ParseTuple(args, "iiO:ReplaceText", &cCharacterPosition, &cNumToReplace, &obpcharText) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obpcharText, &pcharText)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIDDTA->ReplaceText( cCharacterPosition, cNumToReplace, pcharText ); if (pcharText) SysFreeString(pcharText); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return OleSetOleError(hr); Py_INCREF(Py_None); return Py_None; }
STDMETHODIMP PyGDebugDocumentTextExternalAuthor::GetFileName( /* [out] */ BSTR __RPC_FAR * pbstrShortName) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetFileName", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obpbstrShortName; if (!PyArg_Parse(result, "O" , &obpbstrShortName)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obpbstrShortName, pbstrShortName)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; }
STDMETHODIMP PyGDebugExpression::GetResultAsString( /* [out] */ HRESULT __RPC_FAR * phrResult, /* [out] */ BSTR __RPC_FAR * pbstrResult) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetResultAsString", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obpbstrResult; if (!PyArg_ParseTuple(result, "iO" , phrResult, &obpbstrResult)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obpbstrResult, pbstrResult, TRUE)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; }
// @pymethod |PyIRemoteDebugApplicationEvents|OnDebugOutput|Description of OnDebugOutput. PyObject *PyIRemoteDebugApplicationEvents::OnDebugOutput(PyObject *self, PyObject *args) { IRemoteDebugApplicationEvents *pIRDAE = GetI(self); if ( pIRDAE == NULL ) return NULL; // @pyparm <o unicode>|pstr||Description for pstr PyObject *obpstr; BSTR pstr; if ( !PyArg_ParseTuple(args, "O:OnDebugOutput", &obpstr) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_BstrFromPyObject(obpstr, &pstr)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIRDAE->OnDebugOutput( pstr ); if (pstr) SysFreeString(pstr); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return OleSetOleError(hr); Py_INCREF(Py_None); return Py_None; }