[Python-checkins] CVS: python/dist/src/Mac/Modules/cf cfsupport.py,1.5,1.6
Jack Jansen
jackjansen@users.sourceforge.net
Tue, 17 Jul 2001 13:47:15 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules/cf
In directory usw-pr-cvs1:/tmp/cvs-serv28574/Python/Mac/Modules/cf
Modified Files:
cfsupport.py
Log Message:
Used an adapted MethodGenerator to generate methods too for functions that have the object as the second arg after a first CFAllocatorRef arg (which we pass as NULL always anyway).
Index: cfsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cfsupport.py 2001/07/04 22:38:52 1.5
--- cfsupport.py 2001/07/17 20:47:13 1.6
***************
*** 18,26 ****
from macsupport import *
# Create the type objects
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS
! #include <CoreFoundation.h>
#else
#include <CoreFoundation.h>
--- 18,53 ----
from macsupport import *
+ # Special case generator for the functions that have an AllocatorRef first argument,
+ # which we skip anyway, and the object as the second arg.
+ class MethodSkipArg1(MethodGenerator):
+ """Similar to MethodGenerator, but has self as last argument"""
+
+ def parseArgumentList(self, args):
+ if len(args) < 2:
+ raise ValueError, "MethodSkipArg1 expects at least 2 args"
+ a0, a1, args = args[0], args[1], args[2:]
+ t0, n0, m0 = a0
+ if t0 != "CFAllocatorRef" and m0 != InMode:
+ raise ValueError, "MethodSkipArg1 should have dummy AllocatorRef first arg"
+ t1, n1, m1 = a1
+ if m1 != InMode:
+ raise ValueError, "method's 'self' must be 'InMode'"
+ dummy = Variable(t0, n0, m0)
+ self.argumentList.append(dummy)
+ self.itself = Variable(t1, "_self->ob_itself", SelfMode)
+ self.argumentList.append(self.itself)
+ FunctionGenerator.parseArgumentList(self, args)
+
+
# Create the type objects
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS
! #include <CFBase.h>
! #include <CFArray.h>
! #include <CFData.h>
! #include <CFDictionary.h>
! #include <CFString.h>
! #include <CFURL.h>
#else
#include <CoreFoundation.h>
***************
*** 32,35 ****
--- 59,64 ----
staticforward PyObject *CFStringRefObj_New(CFStringRef);
staticforward int CFStringRefObj_Convert(PyObject *, CFStringRef *);
+ staticforward PyObject *CFURLRefObj_New(CFURLRef);
+ staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);