[ctypes-commit] ctypes/comtypes/tools codegenerator.py,1.6.2.12,1.6.2.13
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-07-29 19:47:43
|
Update of /cvsroot/ctypes/ctypes/comtypes/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14714 Modified Files: Tag: branch_1_0 codegenerator.py Log Message: Add helpstrings to the generated typelib wrappers. Index: codegenerator.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/tools/codegenerator.py,v retrieving revision 1.6.2.12 retrieving revision 1.6.2.13 diff -C2 -d -r1.6.2.12 -r1.6.2.13 *** codegenerator.py 28 Jul 2005 07:37:56 -0000 1.6.2.12 --- codegenerator.py 29 Jul 2005 19:47:34 -0000 1.6.2.13 *************** *** 17,20 **** --- 17,27 ---- return "dispid(%s)" % self.memid + class helpstring(object): + def __init__(self, text): + self.text = text + + def __repr__(self): + return "helpstring(%r)" % self.text + class Generator(ctypes.wrap.codegenerator.Generator): *************** *** 62,70 **** self._dispid_defined = True _DISPMETHOD_defined = False def need_DISPMETHOD(self): if self._DISPMETHOD_defined: return ! print >> self.imports, "from comtypes import DISPMETHOD, DISPPROPERTY" self._DISPMETHOD_defined = True --- 69,83 ---- self._dispid_defined = True + def need_COMMETHOD(self): + if self._COMMETHOD_defined: + return + print >> self.imports, "from comtypes import helpstring" + super(Generator, self).need_COMMETHOD() + _DISPMETHOD_defined = False def need_DISPMETHOD(self): if self._DISPMETHOD_defined: return ! print >> self.imports, "from comtypes import DISPMETHOD, DISPPROPERTY, helpstring" self._DISPMETHOD_defined = True *************** *** 265,268 **** --- 278,283 ---- # typ, name, idlflags, default idlflags = [dispid(m.memid)] + m.idlflags + if m.doc: + idlflags.insert(1, helpstring(m.doc)) code = " COMMETHOD(%r, %s, '%s'" % ( idlflags, *************** *** 277,281 **** arglist = [] for typ, name, idlflags, default in m.arguments: ! if 'lcid' in idlflags and 'in' in idlflags: default = lcid if default is not None: --- 292,298 ---- arglist = [] for typ, name, idlflags, default in m.arguments: ! if 'optional' in idlflags and default is None: ! print idlflags ! if 'lcid' in idlflags:# and 'in' in idlflags: default = lcid if default is not None: *************** *** 294,300 **** def make_DispMethod(self, m): # typ, name, idlflags, default code = " DISPMETHOD(%r, %s, '%s'" % ( ! [m.dispid] + m.idlflags, self.type_name(m.returns), m.name) --- 311,320 ---- def make_DispMethod(self, m): + idlflags = [dispid(m.dispid)] + m.idlflags + if m.doc: + idlflags.insert(1, helpstring(m.doc)) # typ, name, idlflags, default code = " DISPMETHOD(%r, %s, '%s'" % ( ! idlflags, self.type_name(m.returns), m.name) *************** *** 323,328 **** def make_DispProperty(self, prop): print >> self.stream, " DISPPROPERTY(%r, %s, '%s')," % ( ! [prop.dispid] + prop.idlflags, self.type_name(prop.typ), prop.name) --- 343,351 ---- def make_DispProperty(self, prop): + idlflags = [dispid(prop.dispid)] + prop.idlflags + if prop.doc: + idlflags.insert(1, helpstring(prop.doc)) print >> self.stream, " DISPPROPERTY(%r, %s, '%s')," % ( ! idlflags, self.type_name(prop.typ), prop.name) |