summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-01-01 22:40:08 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-01-01 22:40:08 (GMT)
commitdcfc20282b8579577fb0aa3f8e5498b174150d81 (patch)
tree6712b6bd6af12f08790c99f756a074cd0e04808a /Tools
parentf1472384dcf23f771e171dbf99b65bded0bf0631 (diff)
downloadcpython-dcfc20282b8579577fb0aa3f8e5498b174150d81.zip
cpython-dcfc20282b8579577fb0aa3f8e5498b174150d81.tar.gz
cpython-dcfc20282b8579577fb0aa3f8e5498b174150d81.tar.bz2
Added some support for Uicode arguments. Still leaves something to be desired, especially because of poor unicode support in PyArg_ParseTuple.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/bgen/bgen/bgenBuffer.py8
-rw-r--r--Tools/bgen/bgen/bgenType.py1
-rw-r--r--Tools/bgen/bgen/macsupport.py15
3 files changed, 23 insertions, 1 deletions
diff --git a/Tools/bgen/bgen/bgenBuffer.py b/Tools/bgen/bgen/bgenBuffer.py
index e948a14..ee4a128 100644
--- a/Tools/bgen/bgen/bgenBuffer.py
+++ b/Tools/bgen/bgen/bgenBuffer.py
@@ -159,7 +159,13 @@ class VarInputBufferType(FixedInputBufferType):
def passInput(self, name):
return "%s__in__, %s__len__" % (name, name)
-
+
+class ReverseInputBufferMixin:
+ """ Mixin for input buffers that are passed as (size, buffer) """
+
+ def passInput(self, name):
+ return "%s__len__, %s__in__" % (name, name)
+
class OptionalVarInputBufferType(OptionalInputBufferMixIn, VarInputBufferType):
pass
diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py
index ac3e74d..fa316a7 100644
--- a/Tools/bgen/bgen/bgenType.py
+++ b/Tools/bgen/bgen/bgenType.py
@@ -149,6 +149,7 @@ double = Type("double", "d")
# For input, this is easy. For output, and for other uses of char *,
# see the module bgenBuffer.
stringptr = InputOnlyType("char*", "s")
+unicodestringptr = InputOnlyType("wchar_t *", "u")
# Some Python related types.
diff --git a/Tools/bgen/bgen/macsupport.py b/Tools/bgen/bgen/macsupport.py
index b02e00b..2caac97 100644
--- a/Tools/bgen/bgen/macsupport.py
+++ b/Tools/bgen/bgen/macsupport.py
@@ -47,6 +47,8 @@ ConstStringPtr = StringPtr
# File System Specifications
FSSpec_ptr = OpaqueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec")
FSSpec = OpaqueByValueType("FSSpec", "PyMac_BuildFSSpec", "PyMac_GetFSSpec")
+FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
+FSRef = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
# OSType and ResType: 4-byte character strings
def OSTypeType(typename):
@@ -111,6 +113,19 @@ OutBuffer = HeapOutputBufferType('char', 'long', 'l') # (buf, len)
VarOutBuffer = VarHeapOutputBufferType('char', 'long', 'l') # (buf, &len)
VarVarOutBuffer = VarVarHeapOutputBufferType('char', 'long', 'l') # (buf, len, &len)
+# Unicode arguments sometimes have reversed len, buffer (don't understand why Apple did this...)
+class VarUnicodeInputBufferType(VarInputBufferType):
+
+ def getargsFormat(self):
+ return "u#"
+
+class VarUnicodeReverseInputBufferType(ReverseInputBufferMixin, VarUnicodeInputBufferType):
+ pass
+
+UnicodeInBuffer = VarUnicodeInputBufferType('UniChar', 'UniCharCount', 'l')
+UnicodeReverseInBuffer = VarUnicodeReverseInputBufferType('UniChar', 'UniCharCount', 'l')
+UniChar_ptr = InputOnlyType("UniCharPtr", "u")
+
# Predefine various pieces of program text to be passed to Module() later: