diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-05-22 21:56:42 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-05-22 21:56:42 (GMT) |
commit | fa77e1a1b1ec479600a0f3a1dbc3faf28140d31f (patch) | |
tree | 405f4572ec550f86d0c2c2b3a84ca672f3a70520 /Mac/Modules/list | |
parent | 1129671350048d9f415d3ba3c411b9bcd8b7ae75 (diff) | |
download | cpython-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/list')
-rw-r--r-- | Mac/Modules/list/Listmodule.c | 206 | ||||
-rw-r--r-- | Mac/Modules/list/listsupport.py | 16 |
2 files changed, 64 insertions, 158 deletions
diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c index 53d070f..6e28613 100644 --- a/Mac/Modules/list/Listmodule.c +++ b/Mac/Modules/list/Listmodule.c @@ -8,8 +8,11 @@ #include "macglue.h" #include "pymactoolbox.h" +#ifdef WITHOUT_FRAMEWORKS #include <Lists.h> - +#else +#include <Carbon/Carbon.h> +#endif #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_ListObj_New(ListHandle); @@ -61,8 +64,7 @@ typedef struct ListObject { int ob_must_be_disposed; } ListObject; -PyObject *ListObj_New(itself) - ListHandle itself; +PyObject *ListObj_New(ListHandle itself) { ListObject *it; if (itself == NULL) { @@ -75,9 +77,7 @@ PyObject *ListObj_New(itself) it->ob_must_be_disposed = 1; return (PyObject *)it; } -ListObj_Convert(v, p_itself) - PyObject *v; - ListHandle *p_itself; +ListObj_Convert(PyObject *v, ListHandle *p_itself) { if (!ListObj_Check(v)) { @@ -88,16 +88,13 @@ ListObj_Convert(v, p_itself) return 1; } -static void ListObj_dealloc(self) - ListObject *self; +static void ListObj_dealloc(ListObject *self) { if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); PyMem_DEL(self); } -static PyObject *ListObj_LAddColumn(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short _rv; @@ -115,9 +112,7 @@ static PyObject *ListObj_LAddColumn(_self, _args) return _res; } -static PyObject *ListObj_LAddRow(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LAddRow(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short _rv; @@ -135,9 +130,7 @@ static PyObject *ListObj_LAddRow(_self, _args) return _res; } -static PyObject *ListObj_LDelColumn(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LDelColumn(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short count; @@ -154,9 +147,7 @@ static PyObject *ListObj_LDelColumn(_self, _args) return _res; } -static PyObject *ListObj_LDelRow(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LDelRow(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short count; @@ -173,9 +164,7 @@ static PyObject *ListObj_LDelRow(_self, _args) return _res; } -static PyObject *ListObj_LGetSelect(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LGetSelect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean _rv; @@ -194,9 +183,7 @@ static PyObject *ListObj_LGetSelect(_self, _args) return _res; } -static PyObject *ListObj_LLastClick(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LLastClick(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Point _rv; @@ -208,9 +195,7 @@ static PyObject *ListObj_LLastClick(_self, _args) return _res; } -static PyObject *ListObj_LNextCell(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LNextCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean _rv; @@ -232,9 +217,7 @@ static PyObject *ListObj_LNextCell(_self, _args) return _res; } -static PyObject *ListObj_LSize(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LSize(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short listWidth; @@ -251,9 +234,7 @@ static PyObject *ListObj_LSize(_self, _args) return _res; } -static PyObject *ListObj_LSetDrawingMode(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LSetDrawingMode(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean drawIt; @@ -267,9 +248,7 @@ static PyObject *ListObj_LSetDrawingMode(_self, _args) return _res; } -static PyObject *ListObj_LScroll(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LScroll(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; short dCols; @@ -286,9 +265,7 @@ static PyObject *ListObj_LScroll(_self, _args) return _res; } -static PyObject *ListObj_LAutoScroll(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LAutoScroll(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) @@ -299,9 +276,7 @@ static PyObject *ListObj_LAutoScroll(_self, _args) return _res; } -static PyObject *ListObj_LUpdate(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LUpdate(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; RgnHandle theRgn; @@ -315,9 +290,7 @@ static PyObject *ListObj_LUpdate(_self, _args) return _res; } -static PyObject *ListObj_LActivate(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LActivate(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean act; @@ -331,9 +304,7 @@ static PyObject *ListObj_LActivate(_self, _args) return _res; } -static PyObject *ListObj_LCellSize(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LCellSize(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Point cSize; @@ -347,9 +318,7 @@ static PyObject *ListObj_LCellSize(_self, _args) return _res; } -static PyObject *ListObj_LClick(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean _rv; @@ -367,9 +336,7 @@ static PyObject *ListObj_LClick(_self, _args) return _res; } -static PyObject *ListObj_LAddToCell(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; char *dataPtr__in__; @@ -390,9 +357,7 @@ static PyObject *ListObj_LAddToCell(_self, _args) return _res; } -static PyObject *ListObj_LClrCell(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LClrCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Point theCell; @@ -406,9 +371,7 @@ static PyObject *ListObj_LClrCell(_self, _args) return _res; } -static PyObject *ListObj_LGetCell(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LGetCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; char *dataPtr__out__; @@ -435,9 +398,7 @@ static PyObject *ListObj_LGetCell(_self, _args) return _res; } -static PyObject *ListObj_LRect(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LRect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Rect cellRect; @@ -453,9 +414,7 @@ static PyObject *ListObj_LRect(_self, _args) return _res; } -static PyObject *ListObj_LSetCell(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; char *dataPtr__in__; @@ -476,9 +435,7 @@ static PyObject *ListObj_LSetCell(_self, _args) return _res; } -static PyObject *ListObj_LSetSelect(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LSetSelect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean setIt; @@ -495,9 +452,7 @@ static PyObject *ListObj_LSetSelect(_self, _args) return _res; } -static PyObject *ListObj_LDraw(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_LDraw(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Point theCell; @@ -511,9 +466,7 @@ static PyObject *ListObj_LDraw(_self, _args) return _res; } -static PyObject *ListObj_as_Resource(_self, _args) - ListObject *_self; - PyObject *_args; +static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; Handle _rv; @@ -577,9 +530,7 @@ static PyMethodDef ListObj_methods[] = { PyMethodChain ListObj_chain = { ListObj_methods, NULL }; -static PyObject *ListObj_getattr(self, name) - ListObject *self; - char *name; +static PyObject *ListObj_getattr(ListObject *self, char *name) { { /* XXXX Should we HLock() here?? */ @@ -592,10 +543,7 @@ static PyObject *ListObj_getattr(self, name) } static int -ListObj_setattr(self, name, value) - ListObject *self; - char *name; - PyObject *value; +ListObj_setattr(ListObject *self, char *name, PyObject *value) { long intval; @@ -643,9 +591,7 @@ PyTypeObject List_Type = { /* ---------------------- End object type List ---------------------- */ -static PyObject *List_LNew(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_LNew(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle _rv; @@ -683,9 +629,7 @@ static PyObject *List_LNew(_self, _args) return _res; } -static PyObject *List_GetListPort(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; CGrafPtr _rv; @@ -699,9 +643,7 @@ static PyObject *List_GetListPort(_self, _args) return _res; } -static PyObject *List_GetListVerticalScrollBar(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListVerticalScrollBar(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ControlHandle _rv; @@ -715,9 +657,7 @@ static PyObject *List_GetListVerticalScrollBar(_self, _args) return _res; } -static PyObject *List_GetListHorizontalScrollBar(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListHorizontalScrollBar(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ControlHandle _rv; @@ -731,9 +671,7 @@ static PyObject *List_GetListHorizontalScrollBar(_self, _args) return _res; } -static PyObject *List_GetListActive(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListActive(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean _rv; @@ -747,9 +685,7 @@ static PyObject *List_GetListActive(_self, _args) return _res; } -static PyObject *List_GetListClickTime(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListClickTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; SInt32 _rv; @@ -763,9 +699,7 @@ static PyObject *List_GetListClickTime(_self, _args) return _res; } -static PyObject *List_GetListRefCon(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListRefCon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; SInt32 _rv; @@ -779,9 +713,7 @@ static PyObject *List_GetListRefCon(_self, _args) return _res; } -static PyObject *List_GetListDefinition(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListDefinition(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; Handle _rv; @@ -795,9 +727,7 @@ static PyObject *List_GetListDefinition(_self, _args) return _res; } -static PyObject *List_GetListUserHandle(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListUserHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; Handle _rv; @@ -811,9 +741,7 @@ static PyObject *List_GetListUserHandle(_self, _args) return _res; } -static PyObject *List_GetListDataHandle(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListDataHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; DataHandle _rv; @@ -827,9 +755,7 @@ static PyObject *List_GetListDataHandle(_self, _args) return _res; } -static PyObject *List_GetListFlags(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OptionBits _rv; @@ -843,9 +769,7 @@ static PyObject *List_GetListFlags(_self, _args) return _res; } -static PyObject *List_GetListSelectionFlags(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_GetListSelectionFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OptionBits _rv; @@ -859,9 +783,7 @@ static PyObject *List_GetListSelectionFlags(_self, _args) return _res; } -static PyObject *List_SetListViewBounds(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -877,9 +799,7 @@ static PyObject *List_SetListViewBounds(_self, _args) return _res; } -static PyObject *List_SetListPort(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -895,9 +815,7 @@ static PyObject *List_SetListPort(_self, _args) return _res; } -static PyObject *List_SetListCellIndent(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListCellIndent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -913,9 +831,7 @@ static PyObject *List_SetListCellIndent(_self, _args) return _res; } -static PyObject *List_SetListClickTime(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListClickTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -931,9 +847,7 @@ static PyObject *List_SetListClickTime(_self, _args) return _res; } -static PyObject *List_SetListRefCon(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListRefCon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -949,9 +863,7 @@ static PyObject *List_SetListRefCon(_self, _args) return _res; } -static PyObject *List_SetListUserHandle(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListUserHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -967,9 +879,7 @@ static PyObject *List_SetListUserHandle(_self, _args) return _res; } -static PyObject *List_SetListFlags(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -985,9 +895,7 @@ static PyObject *List_SetListFlags(_self, _args) return _res; } -static PyObject *List_SetListSelectionFlags(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_SetListSelectionFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ListHandle list; @@ -1003,9 +911,7 @@ static PyObject *List_SetListSelectionFlags(_self, _args) return _res; } -static PyObject *List_as_List(_self, _args) - PyObject *_self; - PyObject *_args; +static PyObject *List_as_List(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1068,15 +974,15 @@ static PyMethodDef List_methods[] = { -void initList() +void initList(void) { PyObject *m; PyObject *d; - PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); m = Py_InitModule("List", List_methods); diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py index 751f16b..d5ddd5b 100644 --- a/Mac/Modules/list/listsupport.py +++ b/Mac/Modules/list/listsupport.py @@ -35,8 +35,11 @@ Handle = OpaqueByValueType("Handle", "ResObj") CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") includestuff = includestuff + """ -#include <%s>""" % MACHEADERFILE + """ - +#ifdef WITHOUT_FRAMEWORKS +#include <Lists.h> +#else +#include <Carbon/Carbon.h> +#endif #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_ListObj_New(ListHandle); @@ -76,8 +79,8 @@ extern int _ListObj_Convert(PyObject *, ListHandle *); """ initstuff = initstuff + """ - PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); """ class ListMethodGenerator(MethodGenerator): @@ -102,10 +105,7 @@ getattrHookCode = """{ setattrCode = """ static int -ListObj_setattr(self, name, value) - ListObject *self; - char *name; - PyObject *value; +ListObj_setattr(ListObject *self, char *name, PyObject *value) { long intval; |