Update of /cvsroot/pywin32/pywin32/com/win32com/makegw
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27146/com/win32com/makegw
Modified Files:
makegwparse.py
Log Message:
Few HWND and similar fixes.
Index: makegwparse.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/makegw/makegwparse.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** makegwparse.py 9 Apr 2008 10:03:21 -0000 1.12
--- makegwparse.py 27 Jul 2008 06:44:59 -0000 1.13
***************
*** 57,61 ****
return "*"
else:
! return "??"
raise error_not_supported, "Can't indirect this far - please fix me :-)"
def GetIndirectedArgName(self, indirectFrom, indirectionTo):
--- 57,61 ----
return "*"
else:
! return "?? (%d)" % (dif,)
raise error_not_supported, "Can't indirect this far - please fix me :-)"
def GetIndirectedArgName(self, indirectFrom, indirectionTo):
***************
*** 240,243 ****
--- 240,271 ----
return s
+ # for types which are 64bits on AMD64 - eg, HWND
+ class ArgFormatterLONG_PTR(ArgFormatter):
+ def GetFormatChar(self):
+ return "O"
+ def DeclareParseArgTupleInputConverter(self):
+ # Declare a PyObject variable
+ return "\tPyObject *ob%s;\n" % self.arg.name
+ def GetParseTupleArg(self):
+ return "&ob"+self.arg.name
+ def _GetPythonTypeDesc(self):
+ return "int/long"
+ def GetBuildValueArg(self):
+ return "ob" + self.arg.name
+ def GetBuildForInterfacePostCode(self):
+ return "\tPy_XDECREF(ob%s);\n" % self.arg.name
+ def DeclareParseArgTupleInputConverter(self):
+ # Declare a PyObject variable
+ return "\tPyObject *ob%s;\n" % self.arg.name
+
+ def GetParsePostCode(self):
+ return "\tif (bPythonIsHappy && !PyWinLong_AsULONG_PTR(ob%s, (ULONG_PTR *)%s)) bPythonIsHappy = FALSE;\n" % (self.arg.name, self.GetIndirectedArgName(None, 2))
+ def GetBuildForInterfacePreCode(self):
+ notdirected = self.GetIndirectedArgName(None, 1)
+ return "\tob%s = PyWinObject_FromULONG_PTR(%s);\n" % \
+ (self.arg.name, notdirected)
+ def GetBuildForGatewayPostCode(self):
+ return "\tPy_XDECREF(ob%s);\n" % self.arg.name
+
class ArgFormatterPythonCOM(ArgFormatter):
"""An arg formatter for types exposed in the PythonCOM module"""
***************
*** 463,471 ****
"int": ("int", "int", "i"),
"long": ("long", "int", "l"),
- "HWND": ("HWND", "HWND", "l"),
- "HDC": ("HDC", "HDC", "l"),
- "LPARAM" : ("LPARAM", "long", "l"),
- "LRESULT" : ("LRESULT", "long", "l"),
- "WPARAM" : ("LPARAM", "int", "i"),
"DISPID": ("DISPID", "long", "l"),
"APPBREAKFLAGS": ("int", "int", "i"),
--- 491,494 ----
***************
*** 524,531 ****
"WORD": (ArgFormatterShort, 0),
"VARIANT_BOOL": (ArgFormatterShort, 0),
! "HWND": (ArgFormatterShort, 0),
! "HMENU": (ArgFormatterShort, 0),
! "HOLEMENU": (ArgFormatterShort, 0),
! "HICON": (ArgFormatterShort, 0),
"UINT": (ArgFormatterShort, 0),
"SVSIF": (ArgFormatterShort, 0),
--- 547,558 ----
"WORD": (ArgFormatterShort, 0),
"VARIANT_BOOL": (ArgFormatterShort, 0),
! "HWND": (ArgFormatterLONG_PTR, 1),
! "HMENU": (ArgFormatterLONG_PTR, 1),
! "HOLEMENU": (ArgFormatterLONG_PTR, 1),
! "HICON": (ArgFormatterLONG_PTR, 1),
! "HDC": (ArgFormatterLONG_PTR, 1),
! "LPARAM": (ArgFormatterLONG_PTR, 1),
! "WPARAM": (ArgFormatterLONG_PTR, 1),
! "LRESULT": (ArgFormatterLONG_PTR, 1),
"UINT": (ArgFormatterShort, 0),
"SVSIF": (ArgFormatterShort, 0),
|