summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/dlg/dlgsupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-05-22 21:56:42 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-05-22 21:56:42 (GMT)
commitfa77e1a1b1ec479600a0f3a1dbc3faf28140d31f (patch)
tree405f4572ec550f86d0c2c2b3a84ca672f3a70520 /Mac/Modules/dlg/dlgsupport.py
parent1129671350048d9f415d3ba3c411b9bcd8b7ae75 (diff)
downloadcpython-fa77e1a1b1ec479600a0f3a1dbc3faf28140d31f.zip
cpython-fa77e1a1b1ec479600a0f3a1dbc3faf28140d31f.tar.gz
cpython-fa77e1a1b1ec479600a0f3a1dbc3faf28140d31f.tar.bz2
Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python.
Diffstat (limited to 'Mac/Modules/dlg/dlgsupport.py')
-rw-r--r--Mac/Modules/dlg/dlgsupport.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index 460d3b9..b166b42 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -31,7 +31,12 @@ StringPtr = Str255
EventMask = Type("EventMask", "H")
includestuff = includestuff + """
+#ifdef WITHOUT_FRAMEWORKS
#include <Dialogs.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
#ifdef USE_TOOLBOX_OBJECT_GLUE
extern PyObject *_DlgObj_New(DialogRef);
extern PyObject *_DlgObj_WhichDialog(DialogRef);
@@ -150,8 +155,7 @@ finalstuff = finalstuff + """
/* Return the WindowPtr corresponding to a DialogObject */
#if 0
WindowPtr
-DlgObj_ConvertToWindow(self)
- PyObject *self;
+DlgObj_ConvertToWindow(PyObject *self)
{
if ( DlgObj_Check(self) )
return GetDialogWindow(((DialogObject *)self)->ob_itself);
@@ -161,8 +165,7 @@ DlgObj_ConvertToWindow(self)
/* Return the object corresponding to the dialog, or None */
PyObject *
-DlgObj_WhichDialog(d)
- DialogPtr d;
+DlgObj_WhichDialog(DialogPtr d)
{
PyObject *it;
@@ -191,9 +194,9 @@ DlgObj_WhichDialog(d)
"""
initstuff = initstuff + """
- PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert);
"""
@@ -219,10 +222,7 @@ class MyObjectDefinition(GlobalObjectDefinition):
def outputCompare(self):
Output()
- Output("static int %s_compare(self, other)", self.prefix)
- IndentLevel()
- Output("%s *self, *other;", self.objecttype)
- DedentLevel()
+ Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype)
OutLbrace()
Output("if ( self->ob_itself > other->ob_itself ) return 1;")
Output("if ( self->ob_itself < other->ob_itself ) return -1;")
@@ -231,10 +231,7 @@ class MyObjectDefinition(GlobalObjectDefinition):
def outputHash(self):
Output()
- Output("static int %s_hash(self)", self.prefix)
- IndentLevel()
- Output("%s *self;", self.objecttype)
- DedentLevel()
+ Output("static int %s_hash(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("return (int)self->ob_itself;")
OutRbrace()
@@ -293,7 +290,7 @@ setuseritembody = """
Py_INCREF(Py_None);
} else {
Py_INCREF(new);
- _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemProc(Dlg_UnivUserItemProc));
+ _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemUPP(Dlg_UnivUserItemProc));
}
Dlg_UserItemProc_callback = new;