| 1 | n/a | |
|---|
| 2 | n/a | /* ========================== Module _List ========================== */ |
|---|
| 3 | n/a | |
|---|
| 4 | n/a | #include "Python.h" |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | #ifndef __LP64__ |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | |
|---|
| 9 | n/a | #include "pymactoolbox.h" |
|---|
| 10 | n/a | |
|---|
| 11 | n/a | /* Macro to test whether a weak-loaded CFM function exists */ |
|---|
| 12 | n/a | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
|---|
| 13 | n/a | PyErr_SetString(PyExc_NotImplementedError, \ |
|---|
| 14 | n/a | "Not available in this shared library/OS version"); \ |
|---|
| 15 | n/a | return NULL; \ |
|---|
| 16 | n/a | }} while(0) |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | #include <Carbon/Carbon.h> |
|---|
| 20 | n/a | |
|---|
| 21 | n/a | #ifdef USE_TOOLBOX_OBJECT_GLUE |
|---|
| 22 | n/a | extern PyObject *_ListObj_New(ListHandle); |
|---|
| 23 | n/a | extern int _ListObj_Convert(PyObject *, ListHandle *); |
|---|
| 24 | n/a | |
|---|
| 25 | n/a | #define ListObj_New _ListObj_New |
|---|
| 26 | n/a | #define ListObj_Convert _ListObj_Convert |
|---|
| 27 | n/a | #endif |
|---|
| 28 | n/a | |
|---|
| 29 | n/a | #define as_List(x) ((ListHandle)x) |
|---|
| 30 | n/a | #define as_Resource(lh) ((Handle)lh) |
|---|
| 31 | n/a | |
|---|
| 32 | n/a | static ListDefUPP myListDefFunctionUPP; |
|---|
| 33 | n/a | |
|---|
| 34 | n/a | |
|---|
| 35 | n/a | static PyObject *List_Error; |
|---|
| 36 | n/a | |
|---|
| 37 | n/a | /* ------------------------ Object type List ------------------------ */ |
|---|
| 38 | n/a | |
|---|
| 39 | n/a | PyTypeObject List_Type; |
|---|
| 40 | n/a | |
|---|
| 41 | n/a | #define ListObj_Check(x) ((x)->ob_type == &List_Type || PyObject_TypeCheck((x), &List_Type)) |
|---|
| 42 | n/a | |
|---|
| 43 | n/a | typedef struct ListObject { |
|---|
| 44 | n/a | PyObject_HEAD |
|---|
| 45 | n/a | ListHandle ob_itself; |
|---|
| 46 | n/a | PyObject *ob_ldef_func; |
|---|
| 47 | n/a | int ob_must_be_disposed; |
|---|
| 48 | n/a | } ListObject; |
|---|
| 49 | n/a | |
|---|
| 50 | n/a | PyObject *ListObj_New(ListHandle itself) |
|---|
| 51 | n/a | { |
|---|
| 52 | n/a | ListObject *it; |
|---|
| 53 | n/a | if (itself == NULL) { |
|---|
| 54 | n/a | PyErr_SetString(List_Error,"Cannot create null List"); |
|---|
| 55 | n/a | return NULL; |
|---|
| 56 | n/a | } |
|---|
| 57 | n/a | it = PyObject_NEW(ListObject, &List_Type); |
|---|
| 58 | n/a | if (it == NULL) return NULL; |
|---|
| 59 | n/a | it->ob_itself = itself; |
|---|
| 60 | n/a | it->ob_ldef_func = NULL; |
|---|
| 61 | n/a | it->ob_must_be_disposed = 1; |
|---|
| 62 | n/a | SetListRefCon(itself, (long)it); |
|---|
| 63 | n/a | return (PyObject *)it; |
|---|
| 64 | n/a | } |
|---|
| 65 | n/a | |
|---|
| 66 | n/a | int ListObj_Convert(PyObject *v, ListHandle *p_itself) |
|---|
| 67 | n/a | { |
|---|
| 68 | n/a | if (!ListObj_Check(v)) |
|---|
| 69 | n/a | { |
|---|
| 70 | n/a | PyErr_SetString(PyExc_TypeError, "List required"); |
|---|
| 71 | n/a | return 0; |
|---|
| 72 | n/a | } |
|---|
| 73 | n/a | *p_itself = ((ListObject *)v)->ob_itself; |
|---|
| 74 | n/a | return 1; |
|---|
| 75 | n/a | } |
|---|
| 76 | n/a | |
|---|
| 77 | n/a | static void ListObj_dealloc(ListObject *self) |
|---|
| 78 | n/a | { |
|---|
| 79 | n/a | Py_XDECREF(self->ob_ldef_func); |
|---|
| 80 | n/a | self->ob_ldef_func = NULL; |
|---|
| 81 | n/a | SetListRefCon(self->ob_itself, (long)0); |
|---|
| 82 | n/a | if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); |
|---|
| 83 | n/a | self->ob_type->tp_free((PyObject *)self); |
|---|
| 84 | n/a | } |
|---|
| 85 | n/a | |
|---|
| 86 | n/a | static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args) |
|---|
| 87 | n/a | { |
|---|
| 88 | n/a | PyObject *_res = NULL; |
|---|
| 89 | n/a | short _rv; |
|---|
| 90 | n/a | short count; |
|---|
| 91 | n/a | short colNum; |
|---|
| 92 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 93 | n/a | &count, |
|---|
| 94 | n/a | &colNum)) |
|---|
| 95 | n/a | return NULL; |
|---|
| 96 | n/a | _rv = LAddColumn(count, |
|---|
| 97 | n/a | colNum, |
|---|
| 98 | n/a | _self->ob_itself); |
|---|
| 99 | n/a | _res = Py_BuildValue("h", |
|---|
| 100 | n/a | _rv); |
|---|
| 101 | n/a | return _res; |
|---|
| 102 | n/a | } |
|---|
| 103 | n/a | |
|---|
| 104 | n/a | static PyObject *ListObj_LAddRow(ListObject *_self, PyObject *_args) |
|---|
| 105 | n/a | { |
|---|
| 106 | n/a | PyObject *_res = NULL; |
|---|
| 107 | n/a | short _rv; |
|---|
| 108 | n/a | short count; |
|---|
| 109 | n/a | short rowNum; |
|---|
| 110 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 111 | n/a | &count, |
|---|
| 112 | n/a | &rowNum)) |
|---|
| 113 | n/a | return NULL; |
|---|
| 114 | n/a | _rv = LAddRow(count, |
|---|
| 115 | n/a | rowNum, |
|---|
| 116 | n/a | _self->ob_itself); |
|---|
| 117 | n/a | _res = Py_BuildValue("h", |
|---|
| 118 | n/a | _rv); |
|---|
| 119 | n/a | return _res; |
|---|
| 120 | n/a | } |
|---|
| 121 | n/a | |
|---|
| 122 | n/a | static PyObject *ListObj_LDelColumn(ListObject *_self, PyObject *_args) |
|---|
| 123 | n/a | { |
|---|
| 124 | n/a | PyObject *_res = NULL; |
|---|
| 125 | n/a | short count; |
|---|
| 126 | n/a | short colNum; |
|---|
| 127 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 128 | n/a | &count, |
|---|
| 129 | n/a | &colNum)) |
|---|
| 130 | n/a | return NULL; |
|---|
| 131 | n/a | LDelColumn(count, |
|---|
| 132 | n/a | colNum, |
|---|
| 133 | n/a | _self->ob_itself); |
|---|
| 134 | n/a | Py_INCREF(Py_None); |
|---|
| 135 | n/a | _res = Py_None; |
|---|
| 136 | n/a | return _res; |
|---|
| 137 | n/a | } |
|---|
| 138 | n/a | |
|---|
| 139 | n/a | static PyObject *ListObj_LDelRow(ListObject *_self, PyObject *_args) |
|---|
| 140 | n/a | { |
|---|
| 141 | n/a | PyObject *_res = NULL; |
|---|
| 142 | n/a | short count; |
|---|
| 143 | n/a | short rowNum; |
|---|
| 144 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 145 | n/a | &count, |
|---|
| 146 | n/a | &rowNum)) |
|---|
| 147 | n/a | return NULL; |
|---|
| 148 | n/a | LDelRow(count, |
|---|
| 149 | n/a | rowNum, |
|---|
| 150 | n/a | _self->ob_itself); |
|---|
| 151 | n/a | Py_INCREF(Py_None); |
|---|
| 152 | n/a | _res = Py_None; |
|---|
| 153 | n/a | return _res; |
|---|
| 154 | n/a | } |
|---|
| 155 | n/a | |
|---|
| 156 | n/a | static PyObject *ListObj_LGetSelect(ListObject *_self, PyObject *_args) |
|---|
| 157 | n/a | { |
|---|
| 158 | n/a | PyObject *_res = NULL; |
|---|
| 159 | n/a | Boolean _rv; |
|---|
| 160 | n/a | Boolean next; |
|---|
| 161 | n/a | Point theCell; |
|---|
| 162 | n/a | if (!PyArg_ParseTuple(_args, "bO&", |
|---|
| 163 | n/a | &next, |
|---|
| 164 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 165 | n/a | return NULL; |
|---|
| 166 | n/a | _rv = LGetSelect(next, |
|---|
| 167 | n/a | &theCell, |
|---|
| 168 | n/a | _self->ob_itself); |
|---|
| 169 | n/a | _res = Py_BuildValue("bO&", |
|---|
| 170 | n/a | _rv, |
|---|
| 171 | n/a | PyMac_BuildPoint, theCell); |
|---|
| 172 | n/a | return _res; |
|---|
| 173 | n/a | } |
|---|
| 174 | n/a | |
|---|
| 175 | n/a | static PyObject *ListObj_LLastClick(ListObject *_self, PyObject *_args) |
|---|
| 176 | n/a | { |
|---|
| 177 | n/a | PyObject *_res = NULL; |
|---|
| 178 | n/a | Point _rv; |
|---|
| 179 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 180 | n/a | return NULL; |
|---|
| 181 | n/a | _rv = LLastClick(_self->ob_itself); |
|---|
| 182 | n/a | _res = Py_BuildValue("O&", |
|---|
| 183 | n/a | PyMac_BuildPoint, _rv); |
|---|
| 184 | n/a | return _res; |
|---|
| 185 | n/a | } |
|---|
| 186 | n/a | |
|---|
| 187 | n/a | static PyObject *ListObj_LNextCell(ListObject *_self, PyObject *_args) |
|---|
| 188 | n/a | { |
|---|
| 189 | n/a | PyObject *_res = NULL; |
|---|
| 190 | n/a | Boolean _rv; |
|---|
| 191 | n/a | Boolean hNext; |
|---|
| 192 | n/a | Boolean vNext; |
|---|
| 193 | n/a | Point theCell; |
|---|
| 194 | n/a | if (!PyArg_ParseTuple(_args, "bbO&", |
|---|
| 195 | n/a | &hNext, |
|---|
| 196 | n/a | &vNext, |
|---|
| 197 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 198 | n/a | return NULL; |
|---|
| 199 | n/a | _rv = LNextCell(hNext, |
|---|
| 200 | n/a | vNext, |
|---|
| 201 | n/a | &theCell, |
|---|
| 202 | n/a | _self->ob_itself); |
|---|
| 203 | n/a | _res = Py_BuildValue("bO&", |
|---|
| 204 | n/a | _rv, |
|---|
| 205 | n/a | PyMac_BuildPoint, theCell); |
|---|
| 206 | n/a | return _res; |
|---|
| 207 | n/a | } |
|---|
| 208 | n/a | |
|---|
| 209 | n/a | static PyObject *ListObj_LSize(ListObject *_self, PyObject *_args) |
|---|
| 210 | n/a | { |
|---|
| 211 | n/a | PyObject *_res = NULL; |
|---|
| 212 | n/a | short listWidth; |
|---|
| 213 | n/a | short listHeight; |
|---|
| 214 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 215 | n/a | &listWidth, |
|---|
| 216 | n/a | &listHeight)) |
|---|
| 217 | n/a | return NULL; |
|---|
| 218 | n/a | LSize(listWidth, |
|---|
| 219 | n/a | listHeight, |
|---|
| 220 | n/a | _self->ob_itself); |
|---|
| 221 | n/a | Py_INCREF(Py_None); |
|---|
| 222 | n/a | _res = Py_None; |
|---|
| 223 | n/a | return _res; |
|---|
| 224 | n/a | } |
|---|
| 225 | n/a | |
|---|
| 226 | n/a | static PyObject *ListObj_LSetDrawingMode(ListObject *_self, PyObject *_args) |
|---|
| 227 | n/a | { |
|---|
| 228 | n/a | PyObject *_res = NULL; |
|---|
| 229 | n/a | Boolean drawIt; |
|---|
| 230 | n/a | if (!PyArg_ParseTuple(_args, "b", |
|---|
| 231 | n/a | &drawIt)) |
|---|
| 232 | n/a | return NULL; |
|---|
| 233 | n/a | LSetDrawingMode(drawIt, |
|---|
| 234 | n/a | _self->ob_itself); |
|---|
| 235 | n/a | Py_INCREF(Py_None); |
|---|
| 236 | n/a | _res = Py_None; |
|---|
| 237 | n/a | return _res; |
|---|
| 238 | n/a | } |
|---|
| 239 | n/a | |
|---|
| 240 | n/a | static PyObject *ListObj_LScroll(ListObject *_self, PyObject *_args) |
|---|
| 241 | n/a | { |
|---|
| 242 | n/a | PyObject *_res = NULL; |
|---|
| 243 | n/a | short dCols; |
|---|
| 244 | n/a | short dRows; |
|---|
| 245 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 246 | n/a | &dCols, |
|---|
| 247 | n/a | &dRows)) |
|---|
| 248 | n/a | return NULL; |
|---|
| 249 | n/a | LScroll(dCols, |
|---|
| 250 | n/a | dRows, |
|---|
| 251 | n/a | _self->ob_itself); |
|---|
| 252 | n/a | Py_INCREF(Py_None); |
|---|
| 253 | n/a | _res = Py_None; |
|---|
| 254 | n/a | return _res; |
|---|
| 255 | n/a | } |
|---|
| 256 | n/a | |
|---|
| 257 | n/a | static PyObject *ListObj_LAutoScroll(ListObject *_self, PyObject *_args) |
|---|
| 258 | n/a | { |
|---|
| 259 | n/a | PyObject *_res = NULL; |
|---|
| 260 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 261 | n/a | return NULL; |
|---|
| 262 | n/a | LAutoScroll(_self->ob_itself); |
|---|
| 263 | n/a | Py_INCREF(Py_None); |
|---|
| 264 | n/a | _res = Py_None; |
|---|
| 265 | n/a | return _res; |
|---|
| 266 | n/a | } |
|---|
| 267 | n/a | |
|---|
| 268 | n/a | static PyObject *ListObj_LUpdate(ListObject *_self, PyObject *_args) |
|---|
| 269 | n/a | { |
|---|
| 270 | n/a | PyObject *_res = NULL; |
|---|
| 271 | n/a | RgnHandle theRgn; |
|---|
| 272 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 273 | n/a | ResObj_Convert, &theRgn)) |
|---|
| 274 | n/a | return NULL; |
|---|
| 275 | n/a | LUpdate(theRgn, |
|---|
| 276 | n/a | _self->ob_itself); |
|---|
| 277 | n/a | Py_INCREF(Py_None); |
|---|
| 278 | n/a | _res = Py_None; |
|---|
| 279 | n/a | return _res; |
|---|
| 280 | n/a | } |
|---|
| 281 | n/a | |
|---|
| 282 | n/a | static PyObject *ListObj_LActivate(ListObject *_self, PyObject *_args) |
|---|
| 283 | n/a | { |
|---|
| 284 | n/a | PyObject *_res = NULL; |
|---|
| 285 | n/a | Boolean act; |
|---|
| 286 | n/a | if (!PyArg_ParseTuple(_args, "b", |
|---|
| 287 | n/a | &act)) |
|---|
| 288 | n/a | return NULL; |
|---|
| 289 | n/a | LActivate(act, |
|---|
| 290 | n/a | _self->ob_itself); |
|---|
| 291 | n/a | Py_INCREF(Py_None); |
|---|
| 292 | n/a | _res = Py_None; |
|---|
| 293 | n/a | return _res; |
|---|
| 294 | n/a | } |
|---|
| 295 | n/a | |
|---|
| 296 | n/a | static PyObject *ListObj_LCellSize(ListObject *_self, PyObject *_args) |
|---|
| 297 | n/a | { |
|---|
| 298 | n/a | PyObject *_res = NULL; |
|---|
| 299 | n/a | Point cSize; |
|---|
| 300 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 301 | n/a | PyMac_GetPoint, &cSize)) |
|---|
| 302 | n/a | return NULL; |
|---|
| 303 | n/a | LCellSize(cSize, |
|---|
| 304 | n/a | _self->ob_itself); |
|---|
| 305 | n/a | Py_INCREF(Py_None); |
|---|
| 306 | n/a | _res = Py_None; |
|---|
| 307 | n/a | return _res; |
|---|
| 308 | n/a | } |
|---|
| 309 | n/a | |
|---|
| 310 | n/a | static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args) |
|---|
| 311 | n/a | { |
|---|
| 312 | n/a | PyObject *_res = NULL; |
|---|
| 313 | n/a | Boolean _rv; |
|---|
| 314 | n/a | Point pt; |
|---|
| 315 | n/a | EventModifiers modifiers; |
|---|
| 316 | n/a | if (!PyArg_ParseTuple(_args, "O&H", |
|---|
| 317 | n/a | PyMac_GetPoint, &pt, |
|---|
| 318 | n/a | &modifiers)) |
|---|
| 319 | n/a | return NULL; |
|---|
| 320 | n/a | _rv = LClick(pt, |
|---|
| 321 | n/a | modifiers, |
|---|
| 322 | n/a | _self->ob_itself); |
|---|
| 323 | n/a | _res = Py_BuildValue("b", |
|---|
| 324 | n/a | _rv); |
|---|
| 325 | n/a | return _res; |
|---|
| 326 | n/a | } |
|---|
| 327 | n/a | |
|---|
| 328 | n/a | static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args) |
|---|
| 329 | n/a | { |
|---|
| 330 | n/a | PyObject *_res = NULL; |
|---|
| 331 | n/a | char *dataPtr__in__; |
|---|
| 332 | n/a | short dataPtr__len__; |
|---|
| 333 | n/a | int dataPtr__in_len__; |
|---|
| 334 | n/a | Point theCell; |
|---|
| 335 | n/a | if (!PyArg_ParseTuple(_args, "s#O&", |
|---|
| 336 | n/a | &dataPtr__in__, &dataPtr__in_len__, |
|---|
| 337 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 338 | n/a | return NULL; |
|---|
| 339 | n/a | dataPtr__len__ = dataPtr__in_len__; |
|---|
| 340 | n/a | LAddToCell(dataPtr__in__, dataPtr__len__, |
|---|
| 341 | n/a | theCell, |
|---|
| 342 | n/a | _self->ob_itself); |
|---|
| 343 | n/a | Py_INCREF(Py_None); |
|---|
| 344 | n/a | _res = Py_None; |
|---|
| 345 | n/a | return _res; |
|---|
| 346 | n/a | } |
|---|
| 347 | n/a | |
|---|
| 348 | n/a | static PyObject *ListObj_LClrCell(ListObject *_self, PyObject *_args) |
|---|
| 349 | n/a | { |
|---|
| 350 | n/a | PyObject *_res = NULL; |
|---|
| 351 | n/a | Point theCell; |
|---|
| 352 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 353 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 354 | n/a | return NULL; |
|---|
| 355 | n/a | LClrCell(theCell, |
|---|
| 356 | n/a | _self->ob_itself); |
|---|
| 357 | n/a | Py_INCREF(Py_None); |
|---|
| 358 | n/a | _res = Py_None; |
|---|
| 359 | n/a | return _res; |
|---|
| 360 | n/a | } |
|---|
| 361 | n/a | |
|---|
| 362 | n/a | static PyObject *ListObj_LGetCell(ListObject *_self, PyObject *_args) |
|---|
| 363 | n/a | { |
|---|
| 364 | n/a | PyObject *_res = NULL; |
|---|
| 365 | n/a | char *dataPtr__out__; |
|---|
| 366 | n/a | short dataPtr__len__; |
|---|
| 367 | n/a | int dataPtr__in_len__; |
|---|
| 368 | n/a | Point theCell; |
|---|
| 369 | n/a | if (!PyArg_ParseTuple(_args, "iO&", |
|---|
| 370 | n/a | &dataPtr__in_len__, |
|---|
| 371 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 372 | n/a | return NULL; |
|---|
| 373 | n/a | if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) |
|---|
| 374 | n/a | { |
|---|
| 375 | n/a | PyErr_NoMemory(); |
|---|
| 376 | n/a | goto dataPtr__error__; |
|---|
| 377 | n/a | } |
|---|
| 378 | n/a | dataPtr__len__ = dataPtr__in_len__; |
|---|
| 379 | n/a | LGetCell(dataPtr__out__, &dataPtr__len__, |
|---|
| 380 | n/a | theCell, |
|---|
| 381 | n/a | _self->ob_itself); |
|---|
| 382 | n/a | _res = Py_BuildValue("s#", |
|---|
| 383 | n/a | dataPtr__out__, (int)dataPtr__len__); |
|---|
| 384 | n/a | free(dataPtr__out__); |
|---|
| 385 | n/a | dataPtr__error__: ; |
|---|
| 386 | n/a | return _res; |
|---|
| 387 | n/a | } |
|---|
| 388 | n/a | |
|---|
| 389 | n/a | static PyObject *ListObj_LRect(ListObject *_self, PyObject *_args) |
|---|
| 390 | n/a | { |
|---|
| 391 | n/a | PyObject *_res = NULL; |
|---|
| 392 | n/a | Rect cellRect; |
|---|
| 393 | n/a | Point theCell; |
|---|
| 394 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 395 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 396 | n/a | return NULL; |
|---|
| 397 | n/a | LRect(&cellRect, |
|---|
| 398 | n/a | theCell, |
|---|
| 399 | n/a | _self->ob_itself); |
|---|
| 400 | n/a | _res = Py_BuildValue("O&", |
|---|
| 401 | n/a | PyMac_BuildRect, &cellRect); |
|---|
| 402 | n/a | return _res; |
|---|
| 403 | n/a | } |
|---|
| 404 | n/a | |
|---|
| 405 | n/a | static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args) |
|---|
| 406 | n/a | { |
|---|
| 407 | n/a | PyObject *_res = NULL; |
|---|
| 408 | n/a | char *dataPtr__in__; |
|---|
| 409 | n/a | short dataPtr__len__; |
|---|
| 410 | n/a | int dataPtr__in_len__; |
|---|
| 411 | n/a | Point theCell; |
|---|
| 412 | n/a | if (!PyArg_ParseTuple(_args, "s#O&", |
|---|
| 413 | n/a | &dataPtr__in__, &dataPtr__in_len__, |
|---|
| 414 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 415 | n/a | return NULL; |
|---|
| 416 | n/a | dataPtr__len__ = dataPtr__in_len__; |
|---|
| 417 | n/a | LSetCell(dataPtr__in__, dataPtr__len__, |
|---|
| 418 | n/a | theCell, |
|---|
| 419 | n/a | _self->ob_itself); |
|---|
| 420 | n/a | Py_INCREF(Py_None); |
|---|
| 421 | n/a | _res = Py_None; |
|---|
| 422 | n/a | return _res; |
|---|
| 423 | n/a | } |
|---|
| 424 | n/a | |
|---|
| 425 | n/a | static PyObject *ListObj_LSetSelect(ListObject *_self, PyObject *_args) |
|---|
| 426 | n/a | { |
|---|
| 427 | n/a | PyObject *_res = NULL; |
|---|
| 428 | n/a | Boolean setIt; |
|---|
| 429 | n/a | Point theCell; |
|---|
| 430 | n/a | if (!PyArg_ParseTuple(_args, "bO&", |
|---|
| 431 | n/a | &setIt, |
|---|
| 432 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 433 | n/a | return NULL; |
|---|
| 434 | n/a | LSetSelect(setIt, |
|---|
| 435 | n/a | theCell, |
|---|
| 436 | n/a | _self->ob_itself); |
|---|
| 437 | n/a | Py_INCREF(Py_None); |
|---|
| 438 | n/a | _res = Py_None; |
|---|
| 439 | n/a | return _res; |
|---|
| 440 | n/a | } |
|---|
| 441 | n/a | |
|---|
| 442 | n/a | static PyObject *ListObj_LDraw(ListObject *_self, PyObject *_args) |
|---|
| 443 | n/a | { |
|---|
| 444 | n/a | PyObject *_res = NULL; |
|---|
| 445 | n/a | Point theCell; |
|---|
| 446 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 447 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 448 | n/a | return NULL; |
|---|
| 449 | n/a | LDraw(theCell, |
|---|
| 450 | n/a | _self->ob_itself); |
|---|
| 451 | n/a | Py_INCREF(Py_None); |
|---|
| 452 | n/a | _res = Py_None; |
|---|
| 453 | n/a | return _res; |
|---|
| 454 | n/a | } |
|---|
| 455 | n/a | |
|---|
| 456 | n/a | static PyObject *ListObj_LGetCellDataLocation(ListObject *_self, PyObject *_args) |
|---|
| 457 | n/a | { |
|---|
| 458 | n/a | PyObject *_res = NULL; |
|---|
| 459 | n/a | short offset; |
|---|
| 460 | n/a | short len; |
|---|
| 461 | n/a | Point theCell; |
|---|
| 462 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 463 | n/a | PyMac_GetPoint, &theCell)) |
|---|
| 464 | n/a | return NULL; |
|---|
| 465 | n/a | LGetCellDataLocation(&offset, |
|---|
| 466 | n/a | &len, |
|---|
| 467 | n/a | theCell, |
|---|
| 468 | n/a | _self->ob_itself); |
|---|
| 469 | n/a | _res = Py_BuildValue("hh", |
|---|
| 470 | n/a | offset, |
|---|
| 471 | n/a | len); |
|---|
| 472 | n/a | return _res; |
|---|
| 473 | n/a | } |
|---|
| 474 | n/a | |
|---|
| 475 | n/a | static PyObject *ListObj_GetListPort(ListObject *_self, PyObject *_args) |
|---|
| 476 | n/a | { |
|---|
| 477 | n/a | PyObject *_res = NULL; |
|---|
| 478 | n/a | CGrafPtr _rv; |
|---|
| 479 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 480 | n/a | return NULL; |
|---|
| 481 | n/a | _rv = GetListPort(_self->ob_itself); |
|---|
| 482 | n/a | _res = Py_BuildValue("O&", |
|---|
| 483 | n/a | GrafObj_New, _rv); |
|---|
| 484 | n/a | return _res; |
|---|
| 485 | n/a | } |
|---|
| 486 | n/a | |
|---|
| 487 | n/a | static PyObject *ListObj_GetListVerticalScrollBar(ListObject *_self, PyObject *_args) |
|---|
| 488 | n/a | { |
|---|
| 489 | n/a | PyObject *_res = NULL; |
|---|
| 490 | n/a | ControlHandle _rv; |
|---|
| 491 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 492 | n/a | return NULL; |
|---|
| 493 | n/a | _rv = GetListVerticalScrollBar(_self->ob_itself); |
|---|
| 494 | n/a | _res = Py_BuildValue("O&", |
|---|
| 495 | n/a | CtlObj_New, _rv); |
|---|
| 496 | n/a | return _res; |
|---|
| 497 | n/a | } |
|---|
| 498 | n/a | |
|---|
| 499 | n/a | static PyObject *ListObj_GetListHorizontalScrollBar(ListObject *_self, PyObject *_args) |
|---|
| 500 | n/a | { |
|---|
| 501 | n/a | PyObject *_res = NULL; |
|---|
| 502 | n/a | ControlHandle _rv; |
|---|
| 503 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 504 | n/a | return NULL; |
|---|
| 505 | n/a | _rv = GetListHorizontalScrollBar(_self->ob_itself); |
|---|
| 506 | n/a | _res = Py_BuildValue("O&", |
|---|
| 507 | n/a | CtlObj_New, _rv); |
|---|
| 508 | n/a | return _res; |
|---|
| 509 | n/a | } |
|---|
| 510 | n/a | |
|---|
| 511 | n/a | static PyObject *ListObj_GetListActive(ListObject *_self, PyObject *_args) |
|---|
| 512 | n/a | { |
|---|
| 513 | n/a | PyObject *_res = NULL; |
|---|
| 514 | n/a | Boolean _rv; |
|---|
| 515 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 516 | n/a | return NULL; |
|---|
| 517 | n/a | _rv = GetListActive(_self->ob_itself); |
|---|
| 518 | n/a | _res = Py_BuildValue("b", |
|---|
| 519 | n/a | _rv); |
|---|
| 520 | n/a | return _res; |
|---|
| 521 | n/a | } |
|---|
| 522 | n/a | |
|---|
| 523 | n/a | static PyObject *ListObj_GetListClickTime(ListObject *_self, PyObject *_args) |
|---|
| 524 | n/a | { |
|---|
| 525 | n/a | PyObject *_res = NULL; |
|---|
| 526 | n/a | SInt32 _rv; |
|---|
| 527 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 528 | n/a | return NULL; |
|---|
| 529 | n/a | _rv = GetListClickTime(_self->ob_itself); |
|---|
| 530 | n/a | _res = Py_BuildValue("l", |
|---|
| 531 | n/a | _rv); |
|---|
| 532 | n/a | return _res; |
|---|
| 533 | n/a | } |
|---|
| 534 | n/a | |
|---|
| 535 | n/a | static PyObject *ListObj_GetListRefCon(ListObject *_self, PyObject *_args) |
|---|
| 536 | n/a | { |
|---|
| 537 | n/a | PyObject *_res = NULL; |
|---|
| 538 | n/a | SInt32 _rv; |
|---|
| 539 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 540 | n/a | return NULL; |
|---|
| 541 | n/a | _rv = GetListRefCon(_self->ob_itself); |
|---|
| 542 | n/a | _res = Py_BuildValue("l", |
|---|
| 543 | n/a | _rv); |
|---|
| 544 | n/a | return _res; |
|---|
| 545 | n/a | } |
|---|
| 546 | n/a | |
|---|
| 547 | n/a | static PyObject *ListObj_GetListDefinition(ListObject *_self, PyObject *_args) |
|---|
| 548 | n/a | { |
|---|
| 549 | n/a | PyObject *_res = NULL; |
|---|
| 550 | n/a | Handle _rv; |
|---|
| 551 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 552 | n/a | return NULL; |
|---|
| 553 | n/a | _rv = GetListDefinition(_self->ob_itself); |
|---|
| 554 | n/a | _res = Py_BuildValue("O&", |
|---|
| 555 | n/a | ResObj_New, _rv); |
|---|
| 556 | n/a | return _res; |
|---|
| 557 | n/a | } |
|---|
| 558 | n/a | |
|---|
| 559 | n/a | static PyObject *ListObj_GetListUserHandle(ListObject *_self, PyObject *_args) |
|---|
| 560 | n/a | { |
|---|
| 561 | n/a | PyObject *_res = NULL; |
|---|
| 562 | n/a | Handle _rv; |
|---|
| 563 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 564 | n/a | return NULL; |
|---|
| 565 | n/a | _rv = GetListUserHandle(_self->ob_itself); |
|---|
| 566 | n/a | _res = Py_BuildValue("O&", |
|---|
| 567 | n/a | ResObj_New, _rv); |
|---|
| 568 | n/a | return _res; |
|---|
| 569 | n/a | } |
|---|
| 570 | n/a | |
|---|
| 571 | n/a | static PyObject *ListObj_GetListDataHandle(ListObject *_self, PyObject *_args) |
|---|
| 572 | n/a | { |
|---|
| 573 | n/a | PyObject *_res = NULL; |
|---|
| 574 | n/a | DataHandle _rv; |
|---|
| 575 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 576 | n/a | return NULL; |
|---|
| 577 | n/a | _rv = GetListDataHandle(_self->ob_itself); |
|---|
| 578 | n/a | _res = Py_BuildValue("O&", |
|---|
| 579 | n/a | ResObj_New, _rv); |
|---|
| 580 | n/a | return _res; |
|---|
| 581 | n/a | } |
|---|
| 582 | n/a | |
|---|
| 583 | n/a | static PyObject *ListObj_GetListFlags(ListObject *_self, PyObject *_args) |
|---|
| 584 | n/a | { |
|---|
| 585 | n/a | PyObject *_res = NULL; |
|---|
| 586 | n/a | OptionBits _rv; |
|---|
| 587 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 588 | n/a | return NULL; |
|---|
| 589 | n/a | _rv = GetListFlags(_self->ob_itself); |
|---|
| 590 | n/a | _res = Py_BuildValue("l", |
|---|
| 591 | n/a | _rv); |
|---|
| 592 | n/a | return _res; |
|---|
| 593 | n/a | } |
|---|
| 594 | n/a | |
|---|
| 595 | n/a | static PyObject *ListObj_GetListSelectionFlags(ListObject *_self, PyObject *_args) |
|---|
| 596 | n/a | { |
|---|
| 597 | n/a | PyObject *_res = NULL; |
|---|
| 598 | n/a | OptionBits _rv; |
|---|
| 599 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 600 | n/a | return NULL; |
|---|
| 601 | n/a | _rv = GetListSelectionFlags(_self->ob_itself); |
|---|
| 602 | n/a | _res = Py_BuildValue("l", |
|---|
| 603 | n/a | _rv); |
|---|
| 604 | n/a | return _res; |
|---|
| 605 | n/a | } |
|---|
| 606 | n/a | |
|---|
| 607 | n/a | static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args) |
|---|
| 608 | n/a | { |
|---|
| 609 | n/a | PyObject *_res = NULL; |
|---|
| 610 | n/a | Handle _rv; |
|---|
| 611 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 612 | n/a | return NULL; |
|---|
| 613 | n/a | _rv = as_Resource(_self->ob_itself); |
|---|
| 614 | n/a | _res = Py_BuildValue("O&", |
|---|
| 615 | n/a | ResObj_New, _rv); |
|---|
| 616 | n/a | return _res; |
|---|
| 617 | n/a | } |
|---|
| 618 | n/a | |
|---|
| 619 | n/a | static PyMethodDef ListObj_methods[] = { |
|---|
| 620 | n/a | {"LAddColumn", (PyCFunction)ListObj_LAddColumn, 1, |
|---|
| 621 | n/a | PyDoc_STR("(short count, short colNum) -> (short _rv)")}, |
|---|
| 622 | n/a | {"LAddRow", (PyCFunction)ListObj_LAddRow, 1, |
|---|
| 623 | n/a | PyDoc_STR("(short count, short rowNum) -> (short _rv)")}, |
|---|
| 624 | n/a | {"LDelColumn", (PyCFunction)ListObj_LDelColumn, 1, |
|---|
| 625 | n/a | PyDoc_STR("(short count, short colNum) -> None")}, |
|---|
| 626 | n/a | {"LDelRow", (PyCFunction)ListObj_LDelRow, 1, |
|---|
| 627 | n/a | PyDoc_STR("(short count, short rowNum) -> None")}, |
|---|
| 628 | n/a | {"LGetSelect", (PyCFunction)ListObj_LGetSelect, 1, |
|---|
| 629 | n/a | PyDoc_STR("(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)")}, |
|---|
| 630 | n/a | {"LLastClick", (PyCFunction)ListObj_LLastClick, 1, |
|---|
| 631 | n/a | PyDoc_STR("() -> (Point _rv)")}, |
|---|
| 632 | n/a | {"LNextCell", (PyCFunction)ListObj_LNextCell, 1, |
|---|
| 633 | n/a | PyDoc_STR("(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)")}, |
|---|
| 634 | n/a | {"LSize", (PyCFunction)ListObj_LSize, 1, |
|---|
| 635 | n/a | PyDoc_STR("(short listWidth, short listHeight) -> None")}, |
|---|
| 636 | n/a | {"LSetDrawingMode", (PyCFunction)ListObj_LSetDrawingMode, 1, |
|---|
| 637 | n/a | PyDoc_STR("(Boolean drawIt) -> None")}, |
|---|
| 638 | n/a | {"LScroll", (PyCFunction)ListObj_LScroll, 1, |
|---|
| 639 | n/a | PyDoc_STR("(short dCols, short dRows) -> None")}, |
|---|
| 640 | n/a | {"LAutoScroll", (PyCFunction)ListObj_LAutoScroll, 1, |
|---|
| 641 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 642 | n/a | {"LUpdate", (PyCFunction)ListObj_LUpdate, 1, |
|---|
| 643 | n/a | PyDoc_STR("(RgnHandle theRgn) -> None")}, |
|---|
| 644 | n/a | {"LActivate", (PyCFunction)ListObj_LActivate, 1, |
|---|
| 645 | n/a | PyDoc_STR("(Boolean act) -> None")}, |
|---|
| 646 | n/a | {"LCellSize", (PyCFunction)ListObj_LCellSize, 1, |
|---|
| 647 | n/a | PyDoc_STR("(Point cSize) -> None")}, |
|---|
| 648 | n/a | {"LClick", (PyCFunction)ListObj_LClick, 1, |
|---|
| 649 | n/a | PyDoc_STR("(Point pt, EventModifiers modifiers) -> (Boolean _rv)")}, |
|---|
| 650 | n/a | {"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1, |
|---|
| 651 | n/a | PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")}, |
|---|
| 652 | n/a | {"LClrCell", (PyCFunction)ListObj_LClrCell, 1, |
|---|
| 653 | n/a | PyDoc_STR("(Point theCell) -> None")}, |
|---|
| 654 | n/a | {"LGetCell", (PyCFunction)ListObj_LGetCell, 1, |
|---|
| 655 | n/a | PyDoc_STR("(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)")}, |
|---|
| 656 | n/a | {"LRect", (PyCFunction)ListObj_LRect, 1, |
|---|
| 657 | n/a | PyDoc_STR("(Point theCell) -> (Rect cellRect)")}, |
|---|
| 658 | n/a | {"LSetCell", (PyCFunction)ListObj_LSetCell, 1, |
|---|
| 659 | n/a | PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")}, |
|---|
| 660 | n/a | {"LSetSelect", (PyCFunction)ListObj_LSetSelect, 1, |
|---|
| 661 | n/a | PyDoc_STR("(Boolean setIt, Point theCell) -> None")}, |
|---|
| 662 | n/a | {"LDraw", (PyCFunction)ListObj_LDraw, 1, |
|---|
| 663 | n/a | PyDoc_STR("(Point theCell) -> None")}, |
|---|
| 664 | n/a | {"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1, |
|---|
| 665 | n/a | PyDoc_STR("(Point theCell) -> (short offset, short len)")}, |
|---|
| 666 | n/a | {"GetListPort", (PyCFunction)ListObj_GetListPort, 1, |
|---|
| 667 | n/a | PyDoc_STR("() -> (CGrafPtr _rv)")}, |
|---|
| 668 | n/a | {"GetListVerticalScrollBar", (PyCFunction)ListObj_GetListVerticalScrollBar, 1, |
|---|
| 669 | n/a | PyDoc_STR("() -> (ControlHandle _rv)")}, |
|---|
| 670 | n/a | {"GetListHorizontalScrollBar", (PyCFunction)ListObj_GetListHorizontalScrollBar, 1, |
|---|
| 671 | n/a | PyDoc_STR("() -> (ControlHandle _rv)")}, |
|---|
| 672 | n/a | {"GetListActive", (PyCFunction)ListObj_GetListActive, 1, |
|---|
| 673 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 674 | n/a | {"GetListClickTime", (PyCFunction)ListObj_GetListClickTime, 1, |
|---|
| 675 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 676 | n/a | {"GetListRefCon", (PyCFunction)ListObj_GetListRefCon, 1, |
|---|
| 677 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 678 | n/a | {"GetListDefinition", (PyCFunction)ListObj_GetListDefinition, 1, |
|---|
| 679 | n/a | PyDoc_STR("() -> (Handle _rv)")}, |
|---|
| 680 | n/a | {"GetListUserHandle", (PyCFunction)ListObj_GetListUserHandle, 1, |
|---|
| 681 | n/a | PyDoc_STR("() -> (Handle _rv)")}, |
|---|
| 682 | n/a | {"GetListDataHandle", (PyCFunction)ListObj_GetListDataHandle, 1, |
|---|
| 683 | n/a | PyDoc_STR("() -> (DataHandle _rv)")}, |
|---|
| 684 | n/a | {"GetListFlags", (PyCFunction)ListObj_GetListFlags, 1, |
|---|
| 685 | n/a | PyDoc_STR("() -> (OptionBits _rv)")}, |
|---|
| 686 | n/a | {"GetListSelectionFlags", (PyCFunction)ListObj_GetListSelectionFlags, 1, |
|---|
| 687 | n/a | PyDoc_STR("() -> (OptionBits _rv)")}, |
|---|
| 688 | n/a | {"as_Resource", (PyCFunction)ListObj_as_Resource, 1, |
|---|
| 689 | n/a | PyDoc_STR("() -> (Handle _rv)")}, |
|---|
| 690 | n/a | {NULL, NULL, 0} |
|---|
| 691 | n/a | }; |
|---|
| 692 | n/a | |
|---|
| 693 | n/a | static PyObject *ListObj_get_listFlags(ListObject *self, void *closure) |
|---|
| 694 | n/a | { |
|---|
| 695 | n/a | return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff); |
|---|
| 696 | n/a | } |
|---|
| 697 | n/a | |
|---|
| 698 | n/a | static int ListObj_set_listFlags(ListObject *self, PyObject *v, void *closure) |
|---|
| 699 | n/a | { |
|---|
| 700 | n/a | if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1; |
|---|
| 701 | n/a | return 0; |
|---|
| 702 | n/a | } |
|---|
| 703 | n/a | |
|---|
| 704 | n/a | static PyObject *ListObj_get_selFlags(ListObject *self, void *closure) |
|---|
| 705 | n/a | { |
|---|
| 706 | n/a | return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff); |
|---|
| 707 | n/a | } |
|---|
| 708 | n/a | |
|---|
| 709 | n/a | static int ListObj_set_selFlags(ListObject *self, PyObject *v, void *closure) |
|---|
| 710 | n/a | { |
|---|
| 711 | n/a | if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1; |
|---|
| 712 | n/a | return 0; |
|---|
| 713 | n/a | } |
|---|
| 714 | n/a | |
|---|
| 715 | n/a | static PyObject *ListObj_get_cellSize(ListObject *self, void *closure) |
|---|
| 716 | n/a | { |
|---|
| 717 | n/a | return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize); |
|---|
| 718 | n/a | } |
|---|
| 719 | n/a | |
|---|
| 720 | n/a | static int ListObj_set_cellSize(ListObject *self, PyObject *v, void *closure) |
|---|
| 721 | n/a | { |
|---|
| 722 | n/a | if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1; |
|---|
| 723 | n/a | return 0; |
|---|
| 724 | n/a | } |
|---|
| 725 | n/a | |
|---|
| 726 | n/a | static PyGetSetDef ListObj_getsetlist[] = { |
|---|
| 727 | n/a | {"listFlags", (getter)ListObj_get_listFlags, (setter)ListObj_set_listFlags, NULL}, |
|---|
| 728 | n/a | {"selFlags", (getter)ListObj_get_selFlags, (setter)ListObj_set_selFlags, NULL}, |
|---|
| 729 | n/a | {"cellSize", (getter)ListObj_get_cellSize, (setter)ListObj_set_cellSize, NULL}, |
|---|
| 730 | n/a | {NULL, NULL, NULL, NULL}, |
|---|
| 731 | n/a | }; |
|---|
| 732 | n/a | |
|---|
| 733 | n/a | |
|---|
| 734 | n/a | #define ListObj_compare NULL |
|---|
| 735 | n/a | |
|---|
| 736 | n/a | #define ListObj_repr NULL |
|---|
| 737 | n/a | |
|---|
| 738 | n/a | #define ListObj_hash NULL |
|---|
| 739 | n/a | #define ListObj_tp_init 0 |
|---|
| 740 | n/a | |
|---|
| 741 | n/a | #define ListObj_tp_alloc PyType_GenericAlloc |
|---|
| 742 | n/a | |
|---|
| 743 | n/a | static PyObject *ListObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) |
|---|
| 744 | n/a | { |
|---|
| 745 | n/a | PyObject *_self; |
|---|
| 746 | n/a | ListHandle itself; |
|---|
| 747 | n/a | char *kw[] = {"itself", 0}; |
|---|
| 748 | n/a | |
|---|
| 749 | n/a | if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ListObj_Convert, &itself)) return NULL; |
|---|
| 750 | n/a | if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; |
|---|
| 751 | n/a | ((ListObject *)_self)->ob_itself = itself; |
|---|
| 752 | n/a | return _self; |
|---|
| 753 | n/a | } |
|---|
| 754 | n/a | |
|---|
| 755 | n/a | #define ListObj_tp_free PyObject_Del |
|---|
| 756 | n/a | |
|---|
| 757 | n/a | |
|---|
| 758 | n/a | PyTypeObject List_Type = { |
|---|
| 759 | n/a | PyObject_HEAD_INIT(NULL) |
|---|
| 760 | n/a | 0, /*ob_size*/ |
|---|
| 761 | n/a | "_List.List", /*tp_name*/ |
|---|
| 762 | n/a | sizeof(ListObject), /*tp_basicsize*/ |
|---|
| 763 | n/a | 0, /*tp_itemsize*/ |
|---|
| 764 | n/a | /* methods */ |
|---|
| 765 | n/a | (destructor) ListObj_dealloc, /*tp_dealloc*/ |
|---|
| 766 | n/a | 0, /*tp_print*/ |
|---|
| 767 | n/a | (getattrfunc)0, /*tp_getattr*/ |
|---|
| 768 | n/a | (setattrfunc)0, /*tp_setattr*/ |
|---|
| 769 | n/a | (cmpfunc) ListObj_compare, /*tp_compare*/ |
|---|
| 770 | n/a | (reprfunc) ListObj_repr, /*tp_repr*/ |
|---|
| 771 | n/a | (PyNumberMethods *)0, /* tp_as_number */ |
|---|
| 772 | n/a | (PySequenceMethods *)0, /* tp_as_sequence */ |
|---|
| 773 | n/a | (PyMappingMethods *)0, /* tp_as_mapping */ |
|---|
| 774 | n/a | (hashfunc) ListObj_hash, /*tp_hash*/ |
|---|
| 775 | n/a | 0, /*tp_call*/ |
|---|
| 776 | n/a | 0, /*tp_str*/ |
|---|
| 777 | n/a | PyObject_GenericGetAttr, /*tp_getattro*/ |
|---|
| 778 | n/a | PyObject_GenericSetAttr, /*tp_setattro */ |
|---|
| 779 | n/a | 0, /*tp_as_buffer*/ |
|---|
| 780 | n/a | Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|---|
| 781 | n/a | 0, /*tp_doc*/ |
|---|
| 782 | n/a | 0, /*tp_traverse*/ |
|---|
| 783 | n/a | 0, /*tp_clear*/ |
|---|
| 784 | n/a | 0, /*tp_richcompare*/ |
|---|
| 785 | n/a | 0, /*tp_weaklistoffset*/ |
|---|
| 786 | n/a | 0, /*tp_iter*/ |
|---|
| 787 | n/a | 0, /*tp_iternext*/ |
|---|
| 788 | n/a | ListObj_methods, /* tp_methods */ |
|---|
| 789 | n/a | 0, /*tp_members*/ |
|---|
| 790 | n/a | ListObj_getsetlist, /*tp_getset*/ |
|---|
| 791 | n/a | 0, /*tp_base*/ |
|---|
| 792 | n/a | 0, /*tp_dict*/ |
|---|
| 793 | n/a | 0, /*tp_descr_get*/ |
|---|
| 794 | n/a | 0, /*tp_descr_set*/ |
|---|
| 795 | n/a | 0, /*tp_dictoffset*/ |
|---|
| 796 | n/a | ListObj_tp_init, /* tp_init */ |
|---|
| 797 | n/a | ListObj_tp_alloc, /* tp_alloc */ |
|---|
| 798 | n/a | ListObj_tp_new, /* tp_new */ |
|---|
| 799 | n/a | ListObj_tp_free, /* tp_free */ |
|---|
| 800 | n/a | }; |
|---|
| 801 | n/a | |
|---|
| 802 | n/a | /* ---------------------- End object type List ---------------------- */ |
|---|
| 803 | n/a | |
|---|
| 804 | n/a | |
|---|
| 805 | n/a | static PyObject *List_CreateCustomList(PyObject *_self, PyObject *_args) |
|---|
| 806 | n/a | { |
|---|
| 807 | n/a | PyObject *_res = NULL; |
|---|
| 808 | n/a | Rect rView; |
|---|
| 809 | n/a | Rect dataBounds; |
|---|
| 810 | n/a | Point cellSize; |
|---|
| 811 | n/a | |
|---|
| 812 | n/a | PyObject *listDefFunc; |
|---|
| 813 | n/a | ListDefSpec theSpec; |
|---|
| 814 | n/a | WindowPtr theWindow; |
|---|
| 815 | n/a | Boolean drawIt; |
|---|
| 816 | n/a | Boolean hasGrow; |
|---|
| 817 | n/a | Boolean scrollHoriz; |
|---|
| 818 | n/a | Boolean scrollVert; |
|---|
| 819 | n/a | ListHandle outList; |
|---|
| 820 | n/a | |
|---|
| 821 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&(iO)O&bbbb", |
|---|
| 822 | n/a | PyMac_GetRect, &rView, |
|---|
| 823 | n/a | PyMac_GetRect, &dataBounds, |
|---|
| 824 | n/a | PyMac_GetPoint, &cellSize, |
|---|
| 825 | n/a | &theSpec.defType, &listDefFunc, |
|---|
| 826 | n/a | WinObj_Convert, &theWindow, |
|---|
| 827 | n/a | &drawIt, |
|---|
| 828 | n/a | &hasGrow, |
|---|
| 829 | n/a | &scrollHoriz, |
|---|
| 830 | n/a | &scrollVert)) |
|---|
| 831 | n/a | return NULL; |
|---|
| 832 | n/a | |
|---|
| 833 | n/a | |
|---|
| 834 | n/a | /* Carbon applications use the CreateCustomList API */ |
|---|
| 835 | n/a | theSpec.u.userProc = myListDefFunctionUPP; |
|---|
| 836 | n/a | CreateCustomList(&rView, |
|---|
| 837 | n/a | &dataBounds, |
|---|
| 838 | n/a | cellSize, |
|---|
| 839 | n/a | &theSpec, |
|---|
| 840 | n/a | theWindow, |
|---|
| 841 | n/a | drawIt, |
|---|
| 842 | n/a | hasGrow, |
|---|
| 843 | n/a | scrollHoriz, |
|---|
| 844 | n/a | scrollVert, |
|---|
| 845 | n/a | &outList); |
|---|
| 846 | n/a | |
|---|
| 847 | n/a | |
|---|
| 848 | n/a | _res = ListObj_New(outList); |
|---|
| 849 | n/a | if (_res == NULL) |
|---|
| 850 | n/a | return NULL; |
|---|
| 851 | n/a | Py_INCREF(listDefFunc); |
|---|
| 852 | n/a | ((ListObject*)_res)->ob_ldef_func = listDefFunc; |
|---|
| 853 | n/a | return _res; |
|---|
| 854 | n/a | } |
|---|
| 855 | n/a | |
|---|
| 856 | n/a | static PyObject *List_LNew(PyObject *_self, PyObject *_args) |
|---|
| 857 | n/a | { |
|---|
| 858 | n/a | PyObject *_res = NULL; |
|---|
| 859 | n/a | ListHandle _rv; |
|---|
| 860 | n/a | Rect rView; |
|---|
| 861 | n/a | Rect dataBounds; |
|---|
| 862 | n/a | Point cSize; |
|---|
| 863 | n/a | short theProc; |
|---|
| 864 | n/a | WindowPtr theWindow; |
|---|
| 865 | n/a | Boolean drawIt; |
|---|
| 866 | n/a | Boolean hasGrow; |
|---|
| 867 | n/a | Boolean scrollHoriz; |
|---|
| 868 | n/a | Boolean scrollVert; |
|---|
| 869 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&hO&bbbb", |
|---|
| 870 | n/a | PyMac_GetRect, &rView, |
|---|
| 871 | n/a | PyMac_GetRect, &dataBounds, |
|---|
| 872 | n/a | PyMac_GetPoint, &cSize, |
|---|
| 873 | n/a | &theProc, |
|---|
| 874 | n/a | WinObj_Convert, &theWindow, |
|---|
| 875 | n/a | &drawIt, |
|---|
| 876 | n/a | &hasGrow, |
|---|
| 877 | n/a | &scrollHoriz, |
|---|
| 878 | n/a | &scrollVert)) |
|---|
| 879 | n/a | return NULL; |
|---|
| 880 | n/a | _rv = LNew(&rView, |
|---|
| 881 | n/a | &dataBounds, |
|---|
| 882 | n/a | cSize, |
|---|
| 883 | n/a | theProc, |
|---|
| 884 | n/a | theWindow, |
|---|
| 885 | n/a | drawIt, |
|---|
| 886 | n/a | hasGrow, |
|---|
| 887 | n/a | scrollHoriz, |
|---|
| 888 | n/a | scrollVert); |
|---|
| 889 | n/a | _res = Py_BuildValue("O&", |
|---|
| 890 | n/a | ListObj_New, _rv); |
|---|
| 891 | n/a | return _res; |
|---|
| 892 | n/a | } |
|---|
| 893 | n/a | |
|---|
| 894 | n/a | static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args) |
|---|
| 895 | n/a | { |
|---|
| 896 | n/a | PyObject *_res = NULL; |
|---|
| 897 | n/a | ListHandle list; |
|---|
| 898 | n/a | Rect view; |
|---|
| 899 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 900 | n/a | ListObj_Convert, &list, |
|---|
| 901 | n/a | PyMac_GetRect, &view)) |
|---|
| 902 | n/a | return NULL; |
|---|
| 903 | n/a | SetListViewBounds(list, |
|---|
| 904 | n/a | &view); |
|---|
| 905 | n/a | Py_INCREF(Py_None); |
|---|
| 906 | n/a | _res = Py_None; |
|---|
| 907 | n/a | return _res; |
|---|
| 908 | n/a | } |
|---|
| 909 | n/a | |
|---|
| 910 | n/a | static PyObject *List_SetListPort(PyObject *_self, PyObject *_args) |
|---|
| 911 | n/a | { |
|---|
| 912 | n/a | PyObject *_res = NULL; |
|---|
| 913 | n/a | ListHandle list; |
|---|
| 914 | n/a | CGrafPtr port; |
|---|
| 915 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 916 | n/a | ListObj_Convert, &list, |
|---|
| 917 | n/a | GrafObj_Convert, &port)) |
|---|
| 918 | n/a | return NULL; |
|---|
| 919 | n/a | SetListPort(list, |
|---|
| 920 | n/a | port); |
|---|
| 921 | n/a | Py_INCREF(Py_None); |
|---|
| 922 | n/a | _res = Py_None; |
|---|
| 923 | n/a | return _res; |
|---|
| 924 | n/a | } |
|---|
| 925 | n/a | |
|---|
| 926 | n/a | static PyObject *List_SetListCellIndent(PyObject *_self, PyObject *_args) |
|---|
| 927 | n/a | { |
|---|
| 928 | n/a | PyObject *_res = NULL; |
|---|
| 929 | n/a | ListHandle list; |
|---|
| 930 | n/a | Point indent; |
|---|
| 931 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 932 | n/a | ListObj_Convert, &list, |
|---|
| 933 | n/a | PyMac_GetPoint, &indent)) |
|---|
| 934 | n/a | return NULL; |
|---|
| 935 | n/a | SetListCellIndent(list, |
|---|
| 936 | n/a | &indent); |
|---|
| 937 | n/a | Py_INCREF(Py_None); |
|---|
| 938 | n/a | _res = Py_None; |
|---|
| 939 | n/a | return _res; |
|---|
| 940 | n/a | } |
|---|
| 941 | n/a | |
|---|
| 942 | n/a | static PyObject *List_SetListClickTime(PyObject *_self, PyObject *_args) |
|---|
| 943 | n/a | { |
|---|
| 944 | n/a | PyObject *_res = NULL; |
|---|
| 945 | n/a | ListHandle list; |
|---|
| 946 | n/a | SInt32 time; |
|---|
| 947 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 948 | n/a | ListObj_Convert, &list, |
|---|
| 949 | n/a | &time)) |
|---|
| 950 | n/a | return NULL; |
|---|
| 951 | n/a | SetListClickTime(list, |
|---|
| 952 | n/a | time); |
|---|
| 953 | n/a | Py_INCREF(Py_None); |
|---|
| 954 | n/a | _res = Py_None; |
|---|
| 955 | n/a | return _res; |
|---|
| 956 | n/a | } |
|---|
| 957 | n/a | |
|---|
| 958 | n/a | static PyObject *List_SetListRefCon(PyObject *_self, PyObject *_args) |
|---|
| 959 | n/a | { |
|---|
| 960 | n/a | PyObject *_res = NULL; |
|---|
| 961 | n/a | ListHandle list; |
|---|
| 962 | n/a | SInt32 refCon; |
|---|
| 963 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 964 | n/a | ListObj_Convert, &list, |
|---|
| 965 | n/a | &refCon)) |
|---|
| 966 | n/a | return NULL; |
|---|
| 967 | n/a | SetListRefCon(list, |
|---|
| 968 | n/a | refCon); |
|---|
| 969 | n/a | Py_INCREF(Py_None); |
|---|
| 970 | n/a | _res = Py_None; |
|---|
| 971 | n/a | return _res; |
|---|
| 972 | n/a | } |
|---|
| 973 | n/a | |
|---|
| 974 | n/a | static PyObject *List_SetListUserHandle(PyObject *_self, PyObject *_args) |
|---|
| 975 | n/a | { |
|---|
| 976 | n/a | PyObject *_res = NULL; |
|---|
| 977 | n/a | ListHandle list; |
|---|
| 978 | n/a | Handle userHandle; |
|---|
| 979 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 980 | n/a | ListObj_Convert, &list, |
|---|
| 981 | n/a | ResObj_Convert, &userHandle)) |
|---|
| 982 | n/a | return NULL; |
|---|
| 983 | n/a | SetListUserHandle(list, |
|---|
| 984 | n/a | userHandle); |
|---|
| 985 | n/a | Py_INCREF(Py_None); |
|---|
| 986 | n/a | _res = Py_None; |
|---|
| 987 | n/a | return _res; |
|---|
| 988 | n/a | } |
|---|
| 989 | n/a | |
|---|
| 990 | n/a | static PyObject *List_SetListFlags(PyObject *_self, PyObject *_args) |
|---|
| 991 | n/a | { |
|---|
| 992 | n/a | PyObject *_res = NULL; |
|---|
| 993 | n/a | ListHandle list; |
|---|
| 994 | n/a | OptionBits listFlags; |
|---|
| 995 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 996 | n/a | ListObj_Convert, &list, |
|---|
| 997 | n/a | &listFlags)) |
|---|
| 998 | n/a | return NULL; |
|---|
| 999 | n/a | SetListFlags(list, |
|---|
| 1000 | n/a | listFlags); |
|---|
| 1001 | n/a | Py_INCREF(Py_None); |
|---|
| 1002 | n/a | _res = Py_None; |
|---|
| 1003 | n/a | return _res; |
|---|
| 1004 | n/a | } |
|---|
| 1005 | n/a | |
|---|
| 1006 | n/a | static PyObject *List_SetListSelectionFlags(PyObject *_self, PyObject *_args) |
|---|
| 1007 | n/a | { |
|---|
| 1008 | n/a | PyObject *_res = NULL; |
|---|
| 1009 | n/a | ListHandle list; |
|---|
| 1010 | n/a | OptionBits selectionFlags; |
|---|
| 1011 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 1012 | n/a | ListObj_Convert, &list, |
|---|
| 1013 | n/a | &selectionFlags)) |
|---|
| 1014 | n/a | return NULL; |
|---|
| 1015 | n/a | SetListSelectionFlags(list, |
|---|
| 1016 | n/a | selectionFlags); |
|---|
| 1017 | n/a | Py_INCREF(Py_None); |
|---|
| 1018 | n/a | _res = Py_None; |
|---|
| 1019 | n/a | return _res; |
|---|
| 1020 | n/a | } |
|---|
| 1021 | n/a | |
|---|
| 1022 | n/a | static PyObject *List_as_List(PyObject *_self, PyObject *_args) |
|---|
| 1023 | n/a | { |
|---|
| 1024 | n/a | PyObject *_res = NULL; |
|---|
| 1025 | n/a | |
|---|
| 1026 | n/a | Handle h; |
|---|
| 1027 | n/a | ListObject *l; |
|---|
| 1028 | n/a | if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h)) |
|---|
| 1029 | n/a | return NULL; |
|---|
| 1030 | n/a | l = (ListObject *)ListObj_New(as_List(h)); |
|---|
| 1031 | n/a | l->ob_must_be_disposed = 0; |
|---|
| 1032 | n/a | _res = Py_BuildValue("O", l); |
|---|
| 1033 | n/a | return _res; |
|---|
| 1034 | n/a | |
|---|
| 1035 | n/a | } |
|---|
| 1036 | n/a | #endif /* __LP64__ */ |
|---|
| 1037 | n/a | |
|---|
| 1038 | n/a | static PyMethodDef List_methods[] = { |
|---|
| 1039 | n/a | #ifndef __LP64__ |
|---|
| 1040 | n/a | {"CreateCustomList", (PyCFunction)List_CreateCustomList, 1, |
|---|
| 1041 | n/a | PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")}, |
|---|
| 1042 | n/a | {"LNew", (PyCFunction)List_LNew, 1, |
|---|
| 1043 | n/a | PyDoc_STR("(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)")}, |
|---|
| 1044 | n/a | {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1, |
|---|
| 1045 | n/a | PyDoc_STR("(ListHandle list, Rect view) -> None")}, |
|---|
| 1046 | n/a | {"SetListPort", (PyCFunction)List_SetListPort, 1, |
|---|
| 1047 | n/a | PyDoc_STR("(ListHandle list, CGrafPtr port) -> None")}, |
|---|
| 1048 | n/a | {"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1, |
|---|
| 1049 | n/a | PyDoc_STR("(ListHandle list, Point indent) -> None")}, |
|---|
| 1050 | n/a | {"SetListClickTime", (PyCFunction)List_SetListClickTime, 1, |
|---|
| 1051 | n/a | PyDoc_STR("(ListHandle list, SInt32 time) -> None")}, |
|---|
| 1052 | n/a | {"SetListRefCon", (PyCFunction)List_SetListRefCon, 1, |
|---|
| 1053 | n/a | PyDoc_STR("(ListHandle list, SInt32 refCon) -> None")}, |
|---|
| 1054 | n/a | {"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1, |
|---|
| 1055 | n/a | PyDoc_STR("(ListHandle list, Handle userHandle) -> None")}, |
|---|
| 1056 | n/a | {"SetListFlags", (PyCFunction)List_SetListFlags, 1, |
|---|
| 1057 | n/a | PyDoc_STR("(ListHandle list, OptionBits listFlags) -> None")}, |
|---|
| 1058 | n/a | {"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1, |
|---|
| 1059 | n/a | PyDoc_STR("(ListHandle list, OptionBits selectionFlags) -> None")}, |
|---|
| 1060 | n/a | {"as_List", (PyCFunction)List_as_List, 1, |
|---|
| 1061 | n/a | PyDoc_STR("(Resource)->List.\nReturns List object (which is not auto-freed!)")}, |
|---|
| 1062 | n/a | #endif /* __LP64__ */ |
|---|
| 1063 | n/a | {NULL, NULL, 0} |
|---|
| 1064 | n/a | }; |
|---|
| 1065 | n/a | |
|---|
| 1066 | n/a | #ifndef __LP64__ |
|---|
| 1067 | n/a | |
|---|
| 1068 | n/a | |
|---|
| 1069 | n/a | static void myListDefFunction(SInt16 message, |
|---|
| 1070 | n/a | Boolean selected, |
|---|
| 1071 | n/a | Rect *cellRect, |
|---|
| 1072 | n/a | Cell theCell, |
|---|
| 1073 | n/a | SInt16 dataOffset, |
|---|
| 1074 | n/a | SInt16 dataLen, |
|---|
| 1075 | n/a | ListHandle theList) |
|---|
| 1076 | n/a | { |
|---|
| 1077 | n/a | PyObject *listDefFunc, *args, *rv=NULL; |
|---|
| 1078 | n/a | ListObject *self; |
|---|
| 1079 | n/a | |
|---|
| 1080 | n/a | self = (ListObject*)GetListRefCon(theList); |
|---|
| 1081 | n/a | if (self == NULL || self->ob_itself != theList) |
|---|
| 1082 | n/a | return; /* nothing we can do */ |
|---|
| 1083 | n/a | listDefFunc = self->ob_ldef_func; |
|---|
| 1084 | n/a | if (listDefFunc == NULL) |
|---|
| 1085 | n/a | return; /* nothing we can do */ |
|---|
| 1086 | n/a | args = Py_BuildValue("hbO&O&hhO", message, |
|---|
| 1087 | n/a | selected, |
|---|
| 1088 | n/a | PyMac_BuildRect, cellRect, |
|---|
| 1089 | n/a | PyMac_BuildPoint, theCell, |
|---|
| 1090 | n/a | dataOffset, |
|---|
| 1091 | n/a | dataLen, |
|---|
| 1092 | n/a | self); |
|---|
| 1093 | n/a | if (args != NULL) { |
|---|
| 1094 | n/a | rv = PyEval_CallObject(listDefFunc, args); |
|---|
| 1095 | n/a | Py_DECREF(args); |
|---|
| 1096 | n/a | } |
|---|
| 1097 | n/a | if (rv == NULL) { |
|---|
| 1098 | n/a | PySys_WriteStderr("error in list definition callback:\n"); |
|---|
| 1099 | n/a | PyErr_Print(); |
|---|
| 1100 | n/a | } else { |
|---|
| 1101 | n/a | Py_DECREF(rv); |
|---|
| 1102 | n/a | } |
|---|
| 1103 | n/a | } |
|---|
| 1104 | n/a | #endif /* __LP64__ */ |
|---|
| 1105 | n/a | |
|---|
| 1106 | n/a | |
|---|
| 1107 | n/a | void init_List(void) |
|---|
| 1108 | n/a | { |
|---|
| 1109 | n/a | PyObject *m; |
|---|
| 1110 | n/a | #ifndef __LP64__ |
|---|
| 1111 | n/a | PyObject *d; |
|---|
| 1112 | n/a | |
|---|
| 1113 | n/a | |
|---|
| 1114 | n/a | |
|---|
| 1115 | n/a | myListDefFunctionUPP = NewListDefUPP((ListDefProcPtr)myListDefFunction); |
|---|
| 1116 | n/a | |
|---|
| 1117 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); |
|---|
| 1118 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); |
|---|
| 1119 | n/a | #endif /* __LP64__ */ |
|---|
| 1120 | n/a | |
|---|
| 1121 | n/a | |
|---|
| 1122 | n/a | m = Py_InitModule("_List", List_methods); |
|---|
| 1123 | n/a | #ifndef __LP64__ |
|---|
| 1124 | n/a | d = PyModule_GetDict(m); |
|---|
| 1125 | n/a | List_Error = PyMac_GetOSErrException(); |
|---|
| 1126 | n/a | if (List_Error == NULL || |
|---|
| 1127 | n/a | PyDict_SetItemString(d, "Error", List_Error) != 0) |
|---|
| 1128 | n/a | return; |
|---|
| 1129 | n/a | List_Type.ob_type = &PyType_Type; |
|---|
| 1130 | n/a | if (PyType_Ready(&List_Type) < 0) return; |
|---|
| 1131 | n/a | Py_INCREF(&List_Type); |
|---|
| 1132 | n/a | PyModule_AddObject(m, "List", (PyObject *)&List_Type); |
|---|
| 1133 | n/a | /* Backward-compatible name */ |
|---|
| 1134 | n/a | Py_INCREF(&List_Type); |
|---|
| 1135 | n/a | PyModule_AddObject(m, "ListType", (PyObject *)&List_Type); |
|---|
| 1136 | n/a | #endif /* __LP64__ */ |
|---|
| 1137 | n/a | } |
|---|
| 1138 | n/a | |
|---|
| 1139 | n/a | /* ======================== End module _List ======================== */ |
|---|
| 1140 | n/a | |
|---|