summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/cf/cfsupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-07-17 20:47:13 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-07-17 20:47:13 (GMT)
commit6f70d62855311cb02c0cc9994b3706724cad61fb (patch)
treee568f0fa3f23d36116f945c31b87762776e3c2d7 /Mac/Modules/cf/cfsupport.py
parent3d3a91c18854aabb4f32cfd4a894de5099d4832a (diff)
downloadcpython-6f70d62855311cb02c0cc9994b3706724cad61fb.zip
cpython-6f70d62855311cb02c0cc9994b3706724cad61fb.tar.gz
cpython-6f70d62855311cb02c0cc9994b3706724cad61fb.tar.bz2
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).
Diffstat (limited to 'Mac/Modules/cf/cfsupport.py')
-rw-r--r--Mac/Modules/cf/cfsupport.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py
index ebfe717..5da71d5 100644
--- a/Mac/Modules/cf/cfsupport.py
+++ b/Mac/Modules/cf/cfsupport.py
@@ -17,11 +17,38 @@ OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
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 <CoreFoundation.h>
+#include <CFBase.h>
+#include <CFArray.h>
+#include <CFData.h>
+#include <CFDictionary.h>
+#include <CFString.h>
+#include <CFURL.h>
#else
#include <CoreFoundation.h>
#endif
@@ -31,6 +58,8 @@ staticforward PyObject *CFTypeRefObj_New(CFTypeRef);
staticforward int CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
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 *);