codegen/argtypes.py (UInt64Arg.write_param): Parse long arguments using ParseTuple and friends; allows ints to passed...

Original commit message from CVS:
2006-02-06  Andy Wingo  <wingo@pobox.com>

* codegen/argtypes.py (UInt64Arg.write_param): Parse long
arguments using ParseTuple and friends; allows ints to passed for
longs as a side benefit.
This commit is contained in:
Andy Wingo 2006-02-06 16:24:23 +00:00
parent b92ae45a82
commit fd727fd969
3 changed files with 13 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2006-02-06 Andy Wingo <wingo@pobox.com>
* codegen/argtypes.py (UInt64Arg.write_param): Parse long
arguments using ParseTuple and friends; allows ints to passed for
longs as a side benefit.
2006-02-02 Edward Hervey <edward@fluendo.com>
* gst/gst.override:

View file

@ -294,19 +294,13 @@ class Int64Arg(ArgType):
info.codeafter.append(' return PyLong_FromLongLong(ret);')
class UInt64Arg(ArgType):
dflt = ' if (py_%(name)s)\n' \
' %(name)s = PyLong_AsUnsignedLongLong(py_%(name)s);\n'
before = ' %(name)s = PyLong_AsUnsignedLongLong(py_%(name)s);\n'
def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info):
if pdflt:
info.varlist.add('guint64', pname + ' = ' + pdflt)
info.codebefore.append(self.dflt % {'name':pname})
else:
info.varlist.add('guint64', pname)
info.codebefore.append(self.before % {'name':pname})
info.varlist.add('PyObject', "*py_" + pname + ' = NULL')
info.arglist.append(pname)
info.add_parselist('O!', ['&PyLong_Type', '&py_' + pname], [pname])
if pdflt:
info.varlist.add('guint64', pname + ' = ' + pdflt)
else:
info.varlist.add('guint64', pname)
info.arglist.append(pname)
info.add_parselist('K', ['&' + pname], [pname])
def write_return(self, ptype, ownsreturn, info):
info.varlist.add('guint64', 'ret')
info.codeafter.append(' return PyLong_FromUnsignedLongLong(ret);')

2
common

@ -1 +1 @@
Subproject commit 79d67fe009b6120b82d51df860c78e8361f02aea
Subproject commit 58567e5519f2d00a4592491db1a6e8302993279e