Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/src
In directory sc8-pr-cvs1:/tmp/cvs-serv15274/src
Modified Files:
PyGActiveScript.cpp PyGActiveScriptParse.cpp
PyGActiveScriptSite.cpp PyIActiveScript.cpp
PyIActiveScriptParse.cpp PyIActiveScriptSite.cpp stdafx.cpp
stdafx.h
Log Message:
Remove all the ATL auto-conversion code.
Index: PyGActiveScript.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyGActiveScript.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyGActiveScript.cpp 19 Nov 1999 04:17:02 -0000 1.3
--- PyGActiveScript.cpp 5 Nov 2003 22:05:25 -0000 1.4
***************
*** 72,79 ****
{
PY_GATEWAY_METHOD;
! USES_CONVERSION;
return InvokeViaPolicy( "AddNamedItem", NULL,
! "si",
! OLE2CT(pstrName),
dwFlags);
}
--- 72,79 ----
{
PY_GATEWAY_METHOD;
! PyObject *obName = PyWinObject_FromOLECHAR(pstrName);
return InvokeViaPolicy( "AddNamedItem", NULL,
! "Ni",
! obName,
dwFlags);
}
***************
*** 101,105 ****
return E_POINTER;
PY_GATEWAY_METHOD;
- USES_CONVERSION;
*ppdisp = NULL;
PyObject *result = NULL;
--- 101,104 ----
Index: PyGActiveScriptParse.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyGActiveScriptParse.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyGActiveScriptParse.cpp 1 Jun 2002 02:27:18 -0000 1.3
--- PyGActiveScriptParse.cpp 5 Nov 2003 22:05:25 -0000 1.4
***************
*** 32,55 ****
{
PY_GATEWAY_METHOD;
! USES_CONVERSION;
PyObject *result;
HRESULT hr = InvokeGatewayViaPolicy(this, "AddScriptlet", pexcepinfo, &result,
! "ssssssii",
! OLE2CT(pstrDefaultName),
! OLE2CT(pstrCode),
! OLE2CT(pstrItemName),
! OLE2CT(pstrSubItemName),
! OLE2CT(pstrEventName),
! OLE2CT(pstrDelimiter),
dwSourceContextCookie,
ulStartingLineNumber);
if (FAILED(hr)) return hr;
! if (result && PyString_Check(result)) {
! *pbstrName = A2BSTR(PyString_AS_STRING((PyStringObject*)result));
! }
! Py_DECREF(result);
! return S_OK;
}
!
STDMETHODIMP PyGActiveScriptParse::ParseScriptText(
/* [in] */ LPCOLESTR pstrCode,
--- 32,58 ----
{
PY_GATEWAY_METHOD;
! PyObject *obDefaultName = PyWinObject_FromOLECHAR(pstrDefaultName);
! PyObject *obCode = PyWinObject_FromOLECHAR(pstrCode);
! PyObject *obItemName = PyWinObject_FromOLECHAR(pstrItemName);
! PyObject *obSubItemName = PyWinObject_FromOLECHAR(pstrSubItemName);
! PyObject *obEventName = PyWinObject_FromOLECHAR(pstrEventName);
! PyObject *obDelimiter = PyWinObject_FromOLECHAR(pstrDelimiter);
PyObject *result;
HRESULT hr = InvokeGatewayViaPolicy(this, "AddScriptlet", pexcepinfo, &result,
! "NNNNNNii",
! obDefaultName,
! obCode,
! obItemName,
! obSubItemName,
! obEventName,
! obDelimiter,
dwSourceContextCookie,
ulStartingLineNumber);
if (FAILED(hr)) return hr;
! PyWinObject_AsBstr(result, pbstrName, FALSE);
! Py_XDECREF(result);
! return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
}
!
STDMETHODIMP PyGActiveScriptParse::ParseScriptText(
/* [in] */ LPCOLESTR pstrCode,
***************
*** 64,68 ****
{
PY_GATEWAY_METHOD;
- USES_CONVERSION;
PyObject *context = PyCom_PyObjectFromIUnknown(punkContext, IID_IUnknown, TRUE);
if (context==NULL) {
--- 67,70 ----
***************
*** 72,82 ****
PyObject *result = NULL;
BOOL bWantResult = pvarResult!=NULL;
HRESULT hr = InvokeGatewayViaPolicy(this, "ParseScriptText", pexcepinfo, &result,
! "ssOsiiii",
! OLE2CT(pstrCode),
! OLE2CT(pstrItemName),
context,
! OLE2CT(pstrDelimiter),
dwSourceContextCookie,
ulStartingLineNumber,
--- 74,87 ----
PyObject *result = NULL;
BOOL bWantResult = pvarResult!=NULL;
+ PyObject *obCode = PyWinObject_FromOLECHAR(pstrCode);
+ PyObject *obItemName = PyWinObject_FromOLECHAR(pstrItemName);
+ PyObject *obDelimiter = PyWinObject_FromOLECHAR(pstrDelimiter);
HRESULT hr = InvokeGatewayViaPolicy(this, "ParseScriptText", pexcepinfo, &result,
! "NNONiiii",
! obCode,
! obItemName,
context,
! obDelimiter,
dwSourceContextCookie,
ulStartingLineNumber,
Index: PyGActiveScriptSite.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyGActiveScriptSite.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyGActiveScriptSite.cpp 1 Sep 1999 23:12:46 -0000 1.1
--- PyGActiveScriptSite.cpp 5 Nov 2003 22:05:25 -0000 1.2
***************
*** 30,38 ****
return E_POINTER;
- USES_CONVERSION;
PyObject *result;
HRESULT hr = InvokeViaPolicy("GetItemInfo", &result,
! "zi",
! OLE2A(pstrName),
(int)dwReturnMask);
if (FAILED(hr))
--- 30,38 ----
return E_POINTER;
PyObject *result;
+ PyObject *obName = PyWinObject_FromOLECHAR(pstrName);
HRESULT hr = InvokeViaPolicy("GetItemInfo", &result,
! "Ni",
! obName,
(int)dwReturnMask);
if (FAILED(hr))
***************
*** 105,119 ****
if (FAILED(hr))
return hr;
!
! if ( !PyString_Check(result) )
! {
! Py_DECREF(result);
! return E_NOTIMPL;
! }
!
! USES_CONVERSION;
! *pbstrVersion = A2BSTR(PyString_AS_STRING((PyStringObject *)result));
! Py_DECREF(result);
! return hr;
}
--- 105,111 ----
if (FAILED(hr))
return hr;
! PyWinObject_AsBstr(result, pbstrVersion, FALSE);
! Py_XDECREF(result);
! return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/);
}
Index: PyIActiveScript.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyIActiveScript.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIActiveScript.cpp 1 Sep 1999 23:12:46 -0000 1.1
--- PyIActiveScript.cpp 5 Nov 2003 22:05:25 -0000 1.2
***************
*** 145,161 ****
{
PY_INTERFACE_METHOD;
! const char *pstrName;
int flags;
- if ( !PyArg_ParseTuple(args, "si:AddNamedItem", &pstrName, &flags) )
- return NULL;
-
IActiveScript *pIAS = GetI(self);
if ( pIAS == NULL )
return NULL;
!
! USES_CONVERSION;
PY_INTERFACE_PRECALL;
! HRESULT hr = pIAS->AddNamedItem(A2OLE(pstrName), (DWORD)flags);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return SetPythonCOMError(self, hr);
--- 145,162 ----
{
PY_INTERFACE_METHOD;
! PyObject *obName;
int flags;
IActiveScript *pIAS = GetI(self);
if ( pIAS == NULL )
return NULL;
! if ( !PyArg_ParseTuple(args, "Oi:AddNamedItem", &obName, &flags) )
! return NULL;
! OLECHAR *name;
! if (!PyWinObject_AsWCHAR(obName, &name))
! return NULL;
PY_INTERFACE_PRECALL;
! HRESULT hr = pIAS->AddNamedItem(name, (DWORD)flags);
PY_INTERFACE_POSTCALL;
+ PyWinObject_FreeWCHAR(name);
if ( FAILED(hr) )
return SetPythonCOMError(self, hr);
***************
*** 208,212 ****
return NULL;
- USES_CONVERSION;
IDispatch *pdisp;
PY_INTERFACE_PRECALL;
--- 209,212 ----
Index: PyIActiveScriptParse.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyIActiveScriptParse.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIActiveScriptParse.cpp 19 Nov 1999 04:17:02 -0000 1.2
--- PyIActiveScriptParse.cpp 5 Nov 2003 22:05:25 -0000 1.3
***************
*** 37,76 ****
/* static */ PyObject *PyIActiveScriptParse::AddScriptlet(PyObject *self, PyObject *args)
{
! const char *defaultName;
! const char *code;
! const char *itemName;
! const char *subItemName;
! const char *eventName;
! const char *delimiter;
int sourceContextCookie;
int startingLineNumber;
int flags;
! if ( !PyArg_ParseTuple(args, "zsszsziii:AddScriptlet",
! &defaultName,
! &code,
! &itemName,
! &subItemName,
! &eventName,
! &delimiter,
&sourceContextCookie,
&startingLineNumber,
&flags) )
return NULL;
-
- IActiveScriptParse *pIASP = GetI(self);
- if ( pIASP == NULL )
- return NULL;
-
- USES_CONVERSION;
BSTR bstrName;
EXCEPINFO excepInfo;
memset(&excepInfo, 0, sizeof excepInfo);
PY_INTERFACE_PRECALL;
! HRESULT hr = pIASP->AddScriptlet(A2OLE(defaultName),
! A2OLE(code),
! A2OLE(itemName),
! A2OLE(subItemName),
! A2OLE(eventName),
! A2OLE(delimiter),
(DWORD)sourceContextCookie,
(ULONG)startingLineNumber,
--- 37,90 ----
/* static */ PyObject *PyIActiveScriptParse::AddScriptlet(PyObject *self, PyObject *args)
{
! HRESULT hr;
! PyObject *ret = NULL;
! PyObject *obDefaultName, *obCode, *obItemName, *obSubItemName,
! *obEventName, *obDelimiter;
int sourceContextCookie;
int startingLineNumber;
int flags;
! IActiveScriptParse *pIASP = GetI(self);
! if ( pIASP == NULL )
! return NULL;
! if ( !PyArg_ParseTuple(args, "OOOOOOiii:AddScriptlet",
! &obDefaultName,
! &obCode,
! &obItemName,
! &obSubItemName,
! &obEventName,
! &obDelimiter,
&sourceContextCookie,
&startingLineNumber,
&flags) )
return NULL;
BSTR bstrName;
EXCEPINFO excepInfo;
memset(&excepInfo, 0, sizeof excepInfo);
+ WCHAR *defaultName = NULL,
+ *code = NULL,
+ *itemName = NULL,
+ *subItemName = NULL,
+ *eventName = NULL,
+ *delimiter = NULL;
+ if (!PyWinObject_AsWCHAR(obDefaultName, &defaultName, TRUE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obCode, &code, FALSE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obItemName, &itemName, FALSE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obSubItemName, &subItemName, TRUE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obEventName, &eventName, FALSE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obDelimiter, &delimiter, TRUE))
+ goto done;
+ {
PY_INTERFACE_PRECALL;
! hr = pIASP->AddScriptlet(defaultName,
! code,
! itemName,
! subItemName,
! eventName,
! delimiter,
(DWORD)sourceContextCookie,
(ULONG)startingLineNumber,
***************
*** 79,94 ****
&excepInfo);
PY_INTERFACE_POSTCALL;
! if ( FAILED(hr) )
! return PyCom_BuildPyExceptionFromEXCEPINFO(hr, &excepInfo);
!
! return MakeBstrToObj(bstrName);
}
/* static */ PyObject *PyIActiveScriptParse::ParseScriptText(PyObject *self, PyObject *args)
{
! const char *code;
! const char *itemName;
PyObject *obContext;
! const char *delimiter;
int sourceContextCookie;
int startingLineNumber;
--- 93,120 ----
&excepInfo);
PY_INTERFACE_POSTCALL;
! }
! if ( FAILED(hr) ) {
! PyCom_BuildPyExceptionFromEXCEPINFO(hr, &excepInfo);
! goto done;
! }
! ret = MakeBstrToObj(bstrName);
! done:
! PyWinObject_FreeWCHAR(defaultName);
! PyWinObject_FreeWCHAR(code);
! PyWinObject_FreeWCHAR(itemName);
! PyWinObject_FreeWCHAR(subItemName);
! PyWinObject_FreeWCHAR(eventName);
! PyWinObject_FreeWCHAR(delimiter);
! return ret;
}
/* static */ PyObject *PyIActiveScriptParse::ParseScriptText(PyObject *self, PyObject *args)
{
! PyObject *result = NULL;
! PyObject *obCode, *obItemName, *obDelimiter;
! WCHAR *code = NULL;
! WCHAR *itemName = NULL;
PyObject *obContext;
! WCHAR *delimiter = NULL;
int sourceContextCookie;
int startingLineNumber;
***************
*** 97,106 ****
// it looks at the flags for a reasonable default. If specified
// the flag is not used at all.
! BOOL bWantResult = -1;
! if ( !PyArg_ParseTuple(args, "szOziii|i:ParseScriptText",
! &code,
! &itemName,
&obContext,
! &delimiter,
&sourceContextCookie,
&startingLineNumber,
--- 123,135 ----
// it looks at the flags for a reasonable default. If specified
// the flag is not used at all.
! BOOL bWantResult = (BOOL)-1;
! IActiveScriptParse *pIASP = GetI(self);
! if ( pIASP == NULL )
! return NULL;
! if ( !PyArg_ParseTuple(args, "OOOOiii|i:ParseScriptText",
! &obCode,
! &obItemName,
&obContext,
! &obDelimiter,
&sourceContextCookie,
&startingLineNumber,
***************
*** 108,119 ****
&bWantResult) )
return NULL;
if (bWantResult==-1)
bWantResult = (flags & SCRIPTTEXT_ISEXPRESSION) != 0;
-
- IActiveScriptParse *pIASP = GetI(self);
- if ( pIASP == NULL )
- return NULL;
-
- IUnknown *punkContext = NULL;
if ( obContext != Py_None )
{
--- 137,155 ----
&bWantResult) )
return NULL;
+ IUnknown *punkContext = NULL;
+ VARIANT *pResult = NULL;
+ VARIANT varResult;
+ EXCEPINFO excepInfo;
+ memset(&excepInfo, 0, sizeof excepInfo);
+ HRESULT hr ;
+ if (!PyWinObject_AsWCHAR(obCode, &code, FALSE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obItemName, &itemName, TRUE))
+ goto done;
+ if (!PyWinObject_AsWCHAR(obDelimiter, &delimiter, TRUE))
+ goto done;
+
if (bWantResult==-1)
bWantResult = (flags & SCRIPTTEXT_ISEXPRESSION) != 0;
if ( obContext != Py_None )
{
***************
*** 121,147 ****
{
PyErr_SetString(PyExc_ValueError, "argument is not a PyIUnknown");
! return NULL;
}
punkContext = PyIUnknown::GetI(obContext);
if ( !punkContext )
! return NULL;
/* note: we don't explicitly hold a reference to punkContext */
}
-
- USES_CONVERSION;
- VARIANT *pResult = NULL;
- VARIANT varResult;
if (bWantResult) {
pResult = &varResult;
VariantInit(&varResult);
}
!
! EXCEPINFO excepInfo;
! memset(&excepInfo, 0, sizeof excepInfo);
PY_INTERFACE_PRECALL;
! HRESULT hr = pIASP->ParseScriptText(A2OLE(code),
! A2OLE(itemName),
punkContext,
! A2OLE(delimiter),
(DWORD)sourceContextCookie,
(ULONG)startingLineNumber,
--- 157,177 ----
{
PyErr_SetString(PyExc_ValueError, "argument is not a PyIUnknown");
! goto done;
}
punkContext = PyIUnknown::GetI(obContext);
if ( !punkContext )
! goto done;
/* note: we don't explicitly hold a reference to punkContext */
}
if (bWantResult) {
pResult = &varResult;
VariantInit(&varResult);
}
! {
PY_INTERFACE_PRECALL;
! hr = pIASP->ParseScriptText(code,
! itemName,
punkContext,
! delimiter,
(DWORD)sourceContextCookie,
(ULONG)startingLineNumber,
***************
*** 150,164 ****
&excepInfo);
PY_INTERFACE_POSTCALL;
! if ( FAILED(hr) )
! return PyCom_BuildPyExceptionFromEXCEPINFO(hr, &excepInfo);
if (bWantResult) {
! PyObject *result = PyCom_PyObjectFromVariant(&varResult);
VariantClear(&varResult);
- return result;
} else {
Py_INCREF(Py_None);
! return Py_None;
}
}
--- 180,201 ----
&excepInfo);
PY_INTERFACE_POSTCALL;
! }
! if ( FAILED(hr) ) {
! PyCom_BuildPyExceptionFromEXCEPINFO(hr, &excepInfo);
! goto done;
! }
if (bWantResult) {
! result = PyCom_PyObjectFromVariant(&varResult);
VariantClear(&varResult);
} else {
Py_INCREF(Py_None);
! result = Py_None;
}
+ done:
+ PyWinObject_FreeWCHAR(code);
+ PyWinObject_FreeWCHAR(itemName);
+ PyWinObject_FreeWCHAR(delimiter);
+ return result;
}
Index: PyIActiveScriptSite.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyIActiveScriptSite.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyIActiveScriptSite.cpp 1 Jun 2002 02:27:42 -0000 1.3
--- PyIActiveScriptSite.cpp 5 Nov 2003 22:05:25 -0000 1.4
***************
*** 43,61 ****
{
PY_INTERFACE_METHOD;
! USES_CONVERSION;
! const char *name;
int mask;
- if (!PyArg_ParseTuple(args, "si:GetItemInfo", &name, &mask))
- return NULL;
-
IActiveScriptSite *pMySite = GetI(self);
if (pMySite==NULL) return NULL;
!
IUnknown *punk = NULL;
ITypeInfo *ptype = NULL;
PY_INTERFACE_PRECALL;
! SCODE sc = pMySite->GetItemInfo(T2COLE(name), mask, &punk, &ptype);
PY_INTERFACE_POSTCALL;
if (FAILED(sc))
return SetPythonCOMError(self, sc);
--- 43,62 ----
{
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);
Index: stdafx.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/stdafx.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** stdafx.cpp 1 Sep 1999 23:12:46 -0000 1.1
--- stdafx.cpp 5 Nov 2003 22:05:25 -0000 1.2
***************
*** 2,7 ****
#include "stdafx.h"
-
- #if _ATL_VER >= 0x0200
- # include <atlconv.cpp>
- #endif
--- 2,3 ----
Index: stdafx.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/stdafx.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** stdafx.h 1 Sep 1999 23:12:46 -0000 1.1
--- stdafx.h 5 Nov 2003 22:05:25 -0000 1.2
***************
*** 6,33 ****
#include <limits.h>
#include <Python.h>
// Must come after Python headers.
! #include <atlbase.h>
#include "PythonCOM.h"
#include "PythonCOMServer.h"
- #if _ATL_VER < 0x0200
- typedef EXCEPINFO UserEXCEPINFO;
- typedef VARIANT UserVARIANT;
- typedef BSTR UserBSTR;
- #endif
-
// NOTE - The standard "activscp.h" header is not good enough -
// need to use the IE4 SDK or MSVC6 etc.
#include "activscp.h"
#include "objsafe.h"
-
- #if _ATL_VER < 0x0200
- # include "datapath.h"
- #endif
-
- #include "multinfo.h"
#include "AXScript.h"
--- 6,29 ----
#include <limits.h>
+ #if defined(MAINWIN) && defined(_POSIX_C_SOURCE)
+ # undef _POSIX_C_SOURCE
+ #endif
+
#include <Python.h>
+ #ifndef MS_WINCE // win32 wont need that soon?
// Must come after Python headers.
! #include <windows.h>
! #endif
!
! #include <Python.h>
#include "PythonCOM.h"
#include "PythonCOMServer.h"
// NOTE - The standard "activscp.h" header is not good enough -
// need to use the IE4 SDK or MSVC6 etc.
#include "activscp.h"
#include "objsafe.h"
#include "AXScript.h"
|