]> granicus.if.org Git - python/commitdiff
Added some support for Uicode arguments. Still leaves something to be desired, especi...
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 1 Jan 2002 22:40:08 +0000 (22:40 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 1 Jan 2002 22:40:08 +0000 (22:40 +0000)
Tools/bgen/bgen/bgenBuffer.py
Tools/bgen/bgen/bgenType.py
Tools/bgen/bgen/macsupport.py

index e948a146d9b8361f1e604fad81ecf6231bcc4ded..ee4a128e51b19f2426db47f05795d929c891dd6d 100644 (file)
@@ -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
        
index ac3e74da07b0e526756ab90ad8d4af2b134242fb..fa316a724e1b02e5e63c3b6cde5e9f6d8fbd1390 100644 (file)
@@ -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.
index b02e00be381dbf24ea28152ed686fa05ef179c33..2caac9739713aaed418a0abcd47dfb7c602c6b56 100644 (file)
@@ -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: