Exemplo n.º 1
0
// @pymethod |PyIActiveScriptError|GetSourceLineText|Description of GetSourceLineText.
PyObject *PyIActiveScriptError::GetSourceLineText(PyObject *self, PyObject *args)
{
    PY_INTERFACE_METHOD;
    IActiveScriptError *pIASE = GetI(self);
    if ( pIASE == NULL )
        return NULL;
    BSTR pbstrSourceLine;
    if ( !PyArg_ParseTuple(args, ":GetSourceLineText") )
        return NULL;
    PY_INTERFACE_PRECALL;
    HRESULT hr = pIASE->GetSourceLineText( &pbstrSourceLine );
    PY_INTERFACE_POSTCALL;
    if ( FAILED(hr) )
        return SetPythonCOMError(self, hr);
    PyObject *pyretval = MakeBstrToObj(pbstrSourceLine);
    SysFreeString(pbstrSourceLine);
    return pyretval;
}
Exemplo n.º 2
0
PyObject* PyIADs_getattro(PyObject *ob, PyObject *obname)
{
	char *name = PYWIN_ATTR_CONVERT(obname);
	if (!name) return NULL;

	IADs *p = PyIADs::GetI(ob);
	
	// These are all BSTR values
	BSTR ret = NULL;
	HRESULT hr;
	BOOL bad = FALSE;
	Py_BEGIN_ALLOW_THREADS
	// docs refer to 'property' as AdsPath, but function is ADsPath
	// allow both
	// @prop <o PyUnicode>|ADsPath|
	// @prop <o PyUnicode>|AdsPath|Synonym for ADsPath
	if (strcmp(name, "AdsPath")==0 || strcmp(name, "ADsPath")==0)
		hr = p->get_ADsPath(&ret);
	// @prop <o PyUnicode>|Class|
	else if (strcmp(name, "Class")==0)
		hr = p->get_Class(&ret);
	// @prop <o PyUnicode>|GUID|Like the IADs method, this returns a string rather than a GUID object.
	else if (strcmp(name, "GUID")==0)
		hr = p->get_GUID(&ret);
	// @prop <o PyUnicode>|Name|
	else if (strcmp(name, "Name")==0)
		hr = p->get_Name(&ret);
	// @prop <o PyUnicode>|Parent|
	else if (strcmp(name, "Parent")==0)
		hr = p->get_Parent(&ret);
	// @prop <o PyUnicode>|Schema|
	else if (strcmp(name, "Schema")==0)
		hr = p->get_Schema(&ret);
	else
		bad = TRUE;
	Py_END_ALLOW_THREADS
	if (bad)
		return PyIBase::getattro(ob, obname);
	if (FAILED(hr))
		return PyCom_BuildPyException(hr, p, IID_IADs );
	PyObject *rc = MakeBstrToObj(ret);
	SysFreeString(ret);
	return rc;
}
// @pymethod int|PyIActiveScriptSite|GetDocVersionString|
PyObject *PyIActiveScriptSite::GetDocVersionString(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	if (!PyArg_ParseTuple(args, ":GetDocVersionString"))
		return NULL;

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

	BSTR bstr;
	PY_INTERFACE_PRECALL;
	SCODE sc = pMySite->GetDocVersionString(&bstr);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return SetPythonCOMError(self, sc);
	PyObject * rc = MakeBstrToObj(bstr);
	SysFreeString(bstr);
	return rc;
}
Exemplo n.º 4
0
// @pymethod |PyIDebugDocumentInfo|GetName|Returns the specified name for the document.
PyObject *PyIDebugDocumentInfo::GetName(PyObject *self, PyObject *args)
{
	IDebugDocumentInfo *pIDDP = GetI(self);
	if ( pIDDP == NULL )
		return NULL;
	DOCUMENTNAMETYPE dnt;
	if ( !PyArg_ParseTuple(args, "i:GetName", &dnt) )
		return NULL;
	BSTR pbstrName;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDDP->GetName( dnt, &pbstrName );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *obpbstrName = MakeBstrToObj(pbstrName);
	PyObject *pyretval = Py_BuildValue("O", obpbstrName);
	Py_XDECREF(obpbstrName);
	SysFreeString(pbstrName);
	return pyretval;
}
Exemplo n.º 5
0
// @pymethod |PyIDebugDocumentTextExternalAuthor|GetFileName|Description of GetFileName.
PyObject *PyIDebugDocumentTextExternalAuthor::GetFileName(PyObject *self, PyObject *args)
{
    IDebugDocumentTextExternalAuthor *pIDDTEA = GetI(self);
    if ( pIDDTEA == NULL )
        return NULL;
    BSTR pbstrShortName;
    if ( !PyArg_ParseTuple(args, ":GetFileName") )
        return NULL;
    PY_INTERFACE_PRECALL;
    HRESULT hr = pIDDTEA->GetFileName( &pbstrShortName );
    PY_INTERFACE_POSTCALL;
    if ( FAILED(hr) )
        return OleSetOleError(hr);
    PyObject *obpbstrShortName;

    obpbstrShortName = MakeBstrToObj(pbstrShortName);
    PyObject *pyretval = Py_BuildValue("O", obpbstrShortName);
    Py_XDECREF(obpbstrShortName);
    SysFreeString(pbstrShortName);
    return pyretval;
}
Exemplo n.º 6
0
// @pymethod <o unicode>|PyIDebugStackFrame|GetLanguageString|Returns a short or long textual description of the language.
PyObject *PyIDebugStackFrame::GetLanguageString(PyObject *self, PyObject *args)
{
	IDebugStackFrame *pIDSF = GetI(self);
	if ( pIDSF == NULL )
		return NULL;
	BSTR pbstrDescription;
	BOOL flong;
	// @pyparm int|fLong||If False, just the language name should be provided, eg, "Python". If True a full product description may be provided (eg, "Python 1.4 ActiveX Debugging Host")
	if ( !PyArg_ParseTuple(args, "i:GetLanguageString", &flong) )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDSF->GetLanguageString( flong, &pbstrDescription );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	PyObject *obpbstrDescription;
	obpbstrDescription = MakeBstrToObj(pbstrDescription);
	PyObject *pyretval = Py_BuildValue("O", obpbstrDescription);
	Py_XDECREF(obpbstrDescription);
	return pyretval;
}
Exemplo n.º 7
0
// @pymethod |PyIDebugExpression|GetResultAsString|Description of GetResultAsString.
PyObject *PyIDebugExpression::GetResultAsString(PyObject *self, PyObject *args)
{
	IDebugExpression *pIDE = GetI(self);
	if ( pIDE == NULL )
		return NULL;
	HRESULT phrResult;
	BSTR pbstrResult;
	if ( !PyArg_ParseTuple(args, ":GetResultAsString") )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDE->GetResultAsString( &phrResult, &pbstrResult );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	PyObject *obpbstrResult;

	obpbstrResult = MakeBstrToObj(pbstrResult);
	PyObject *pyretval = Py_BuildValue("iO", phrResult, obpbstrResult);
	Py_XDECREF(obpbstrResult);
	SysFreeString(pbstrResult);
	return pyretval;
}
Exemplo n.º 8
0
// @pymethod <o unicode>|PyIDebugStackFrame|GetDescriptionString|Returns a short or long textual description of the stack frame.
PyObject *PyIDebugStackFrame::GetDescriptionString(PyObject *self, PyObject *args)
{
	IDebugStackFrame *pIDSF = GetI(self);
	if ( pIDSF == NULL )
		return NULL;
	BSTR pbstrDescription;
	BOOL flong;
	// @pyparm int|fLong||If false, provide only the name of the function associated with the stack frame. When true it may also provide the parameter(s) to the function or whatever else is relevant.  
	if ( !PyArg_ParseTuple(args, "i:GetDescriptionString", &flong) )
		return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDSF->GetDescriptionString( flong, &pbstrDescription );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	PyObject *obpbstrDescription;

	obpbstrDescription = MakeBstrToObj(pbstrDescription);
	PyObject *pyretval = Py_BuildValue("O", obpbstrDescription);
	Py_XDECREF(obpbstrDescription);
	return pyretval;
}