summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/list/listsupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-12-23 14:32:06 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-12-23 14:32:06 (GMT)
commita1a0fef2ea9ece5b16f9e6c37800778c64844e69 (patch)
tree6af31ec1186b5ebe0aed89f5c4159445fff61381 /Mac/Modules/list/listsupport.py
parent7b912120caa517ef4fa65eefc26e63f3dea8009a (diff)
downloadcpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.zip
cpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.tar.gz
cpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.tar.bz2
Unified handle-conversion scheme to
handle = Ctl.as_Resource(ctl) ctl = Ctl.as_Control(handle) and similarly for List, Menu, TE. The old handle.as_Control() methods are still there for backward compatability.
Diffstat (limited to 'Mac/Modules/list/listsupport.py')
-rw-r--r--Mac/Modules/list/listsupport.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index 686875d..4fd7d7e 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -27,10 +27,13 @@ VarOutBufferShortsize = VarHeapOutputBufferType('char', 'short', 's') # (buf, &l
InBufferShortsize = VarInputBufferType('char', 'short', 's') # (buf, len)
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
-
+Handle = OpaqueByValueType("Handle", "ResObj")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+
+#define as_List(x) ((ListHandle)x)
+#define as_Resource(lh) ((Handle)lh)
"""
class ListMethodGenerator(MethodGenerator):
@@ -93,7 +96,7 @@ class MyObjectDefinition(GlobalObjectDefinition):
def outputSetattr(self):
Output(setattrCode)
-
+
# From here on it's basically all boiler plate...
# Create the generator groups and link them
@@ -110,6 +113,13 @@ functions = []
methods = []
execfile(INPUTFILE)
+# Function to convert any handle to a list and vv.
+f = Function(ListHandle, 'as_List', (Handle, 'h', InMode))
+functions.append(f)
+
+f = Method(Handle, 'as_Resource', (ListHandle, 'lh', InMode))
+methods.append(f)
+
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)