Whitespace normalization.
[python/dscho.git] / Mac / Modules / waste / wastemodule.c
blob53aff83d2bfd303ab8c8020a71316f12f0b69fdc
2 /* ========================== Module waste ========================== */
4 #include "Python.h"
8 #include "pymactoolbox.h"
10 /* Macro to test whether a weak-loaded CFM function exists */
11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
12 PyErr_SetString(PyExc_NotImplementedError, \
13 "Not available in this shared library/OS version"); \
14 return NULL; \
15 }} while(0)
18 #include <WASTE.h>
19 #include <WEObjectHandlers.h>
20 #include <WETabs.h>
22 /* Exported by Qdmodule.c: */
23 extern PyObject *QdRGB_New(RGBColor *);
24 extern int QdRGB_Convert(PyObject *, RGBColor *);
26 /* Exported by AEModule.c: */
27 extern PyObject *AEDesc_New(AppleEvent *);
28 extern int AEDesc_Convert(PyObject *, AppleEvent *);
30 /* Forward declaration */
31 static PyObject *WEOObj_New(WEObjectReference);
32 static PyObject *ExistingwasteObj_New(WEReference);
35 ** Parse/generate TextStyle records
37 static PyObject *
38 TextStyle_New(TextStylePtr itself)
41 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
42 &itself->tsColor);
45 static int
46 TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
48 long font, face, size;
50 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
51 return 0;
52 p_itself->tsFont = (short)font;
53 p_itself->tsFace = (Style)face;
54 p_itself->tsSize = (short)size;
55 return 1;
59 ** Parse/generate RunInfo records
61 static PyObject *
62 RunInfo_New(WERunInfo *itself)
65 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
66 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
69 /* Conversion of long points and rects */
70 int
71 LongRect_Convert(PyObject *v, LongRect *r)
73 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
76 PyObject *
77 LongRect_New(LongRect *r)
79 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
82 int
83 LongPt_Convert(PyObject *v, LongPt *p)
85 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
88 PyObject *
89 LongPt_New(LongPt *p)
91 return Py_BuildValue("(ll)", p->h, p->v);
94 /* Stuff for the callbacks: */
95 static PyObject *callbackdict;
96 WENewObjectUPP upp_new_handler;
97 WEDisposeObjectUPP upp_dispose_handler;
98 WEDrawObjectUPP upp_draw_handler;
99 WEClickObjectUPP upp_click_handler;
101 static OSErr
102 any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
104 FlavorType tp;
105 PyObject *key, *func;
107 if ( args == NULL ) return errAECorruptData;
109 tp = WEGetObjectType(who);
111 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
112 return errAECorruptData;
113 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
114 Py_DECREF(key);
115 return errAEHandlerNotFound;
117 Py_INCREF(func);
118 *rv = PyEval_CallObject(func, args);
119 Py_DECREF(func);
120 Py_DECREF(key);
121 if ( *rv == NULL ) {
122 PySys_WriteStderr("--Exception in callback: ");
123 PyErr_Print();
124 return errAEReplyNotArrived;
126 return 0;
129 static pascal OSErr
130 my_new_handler(Point *objectSize, WEObjectReference objref)
132 PyObject *args=NULL, *rv=NULL;
133 OSErr err;
135 args=Py_BuildValue("(O&)", WEOObj_New, objref);
136 err = any_handler(weNewHandler, objref, args, &rv);
137 if (!err) {
138 if (!PyMac_GetPoint(rv, objectSize) )
139 err = errAECoercionFail;
141 if ( args ) {
142 Py_DECREF(args);
144 if ( rv ) {
145 Py_DECREF(rv);
147 return err;
150 static pascal OSErr
151 my_dispose_handler(WEObjectReference objref)
153 PyObject *args=NULL, *rv=NULL;
154 OSErr err;
156 args=Py_BuildValue("(O&)", WEOObj_New, objref);
157 err = any_handler(weDisposeHandler, objref, args, &rv);
158 if ( args ) {
159 Py_DECREF(args);
161 if ( rv ) {
162 Py_DECREF(rv);
164 return err;
167 static pascal OSErr
168 my_draw_handler(const Rect *destRect, WEObjectReference objref)
170 PyObject *args=NULL, *rv=NULL;
171 OSErr err;
173 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
174 err = any_handler(weDrawHandler, objref, args, &rv);
175 if ( args ) {
176 Py_DECREF(args);
178 if ( rv ) {
179 Py_DECREF(rv);
181 return err;
184 static pascal Boolean
185 my_click_handler(Point hitPt, EventModifiers modifiers,
186 unsigned long clickTime, WEObjectReference objref)
188 PyObject *args=NULL, *rv=NULL;
189 int retvalue;
190 OSErr err;
192 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
193 (long)modifiers, (long)clickTime, WEOObj_New, objref);
194 err = any_handler(weClickHandler, objref, args, &rv);
195 if (!err)
196 retvalue = PyInt_AsLong(rv);
197 else
198 retvalue = 0;
199 if ( args ) {
200 Py_DECREF(args);
202 if ( rv ) {
203 Py_DECREF(rv);
205 return retvalue;
210 static PyObject *waste_Error;
212 /* ------------------------ Object type WEO ------------------------- */
214 PyTypeObject WEO_Type;
216 #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
218 typedef struct WEOObject {
219 PyObject_HEAD
220 WEObjectReference ob_itself;
221 } WEOObject;
223 PyObject *WEOObj_New(WEObjectReference itself)
225 WEOObject *it;
226 if (itself == NULL) {
227 Py_INCREF(Py_None);
228 return Py_None;
230 it = PyObject_NEW(WEOObject, &WEO_Type);
231 if (it == NULL) return NULL;
232 it->ob_itself = itself;
233 return (PyObject *)it;
235 int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
237 if (!WEOObj_Check(v))
239 PyErr_SetString(PyExc_TypeError, "WEO required");
240 return 0;
242 *p_itself = ((WEOObject *)v)->ob_itself;
243 return 1;
246 static void WEOObj_dealloc(WEOObject *self)
248 /* Cleanup of self->ob_itself goes here */
249 self->ob_type->tp_free((PyObject *)self);
252 static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
254 PyObject *_res = NULL;
255 FlavorType _rv;
256 if (!PyArg_ParseTuple(_args, ""))
257 return NULL;
258 _rv = WEGetObjectType(_self->ob_itself);
259 _res = Py_BuildValue("O&",
260 PyMac_BuildOSType, _rv);
261 return _res;
264 static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
266 PyObject *_res = NULL;
267 Handle _rv;
268 if (!PyArg_ParseTuple(_args, ""))
269 return NULL;
270 _rv = WEGetObjectDataHandle(_self->ob_itself);
271 _res = Py_BuildValue("O&",
272 ResObj_New, _rv);
273 return _res;
276 static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
278 PyObject *_res = NULL;
279 WEReference _rv;
280 if (!PyArg_ParseTuple(_args, ""))
281 return NULL;
282 _rv = WEGetObjectOwner(_self->ob_itself);
283 _res = Py_BuildValue("O&",
284 ExistingwasteObj_New, _rv);
285 return _res;
288 static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
290 PyObject *_res = NULL;
291 SInt32 _rv;
292 if (!PyArg_ParseTuple(_args, ""))
293 return NULL;
294 _rv = WEGetObjectOffset(_self->ob_itself);
295 _res = Py_BuildValue("l",
296 _rv);
297 return _res;
300 static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
302 PyObject *_res = NULL;
303 Point _rv;
304 if (!PyArg_ParseTuple(_args, ""))
305 return NULL;
306 _rv = WEGetObjectSize(_self->ob_itself);
307 _res = Py_BuildValue("O&",
308 PyMac_BuildPoint, _rv);
309 return _res;
312 static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
314 PyObject *_res = NULL;
315 OSErr _err;
316 Point inObjectSize;
317 if (!PyArg_ParseTuple(_args, "O&",
318 PyMac_GetPoint, &inObjectSize))
319 return NULL;
320 _err = WESetObjectSize(_self->ob_itself,
321 inObjectSize);
322 if (_err != noErr) return PyMac_Error(_err);
323 Py_INCREF(Py_None);
324 _res = Py_None;
325 return _res;
328 static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
330 PyObject *_res = NULL;
331 OSErr _err;
332 LongRect outObjectFrame;
333 if (!PyArg_ParseTuple(_args, ""))
334 return NULL;
335 _err = WEGetObjectFrame(_self->ob_itself,
336 &outObjectFrame);
337 if (_err != noErr) return PyMac_Error(_err);
338 _res = Py_BuildValue("O&",
339 LongRect_New, &outObjectFrame);
340 return _res;
343 static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
345 PyObject *_res = NULL;
346 SInt32 _rv;
347 if (!PyArg_ParseTuple(_args, ""))
348 return NULL;
349 _rv = WEGetObjectRefCon(_self->ob_itself);
350 _res = Py_BuildValue("l",
351 _rv);
352 return _res;
355 static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
357 PyObject *_res = NULL;
358 SInt32 inRefCon;
359 if (!PyArg_ParseTuple(_args, "l",
360 &inRefCon))
361 return NULL;
362 WESetObjectRefCon(_self->ob_itself,
363 inRefCon);
364 Py_INCREF(Py_None);
365 _res = Py_None;
366 return _res;
369 static PyMethodDef WEOObj_methods[] = {
370 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
371 PyDoc_STR("() -> (FlavorType _rv)")},
372 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
373 PyDoc_STR("() -> (Handle _rv)")},
374 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
375 PyDoc_STR("() -> (WEReference _rv)")},
376 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
377 PyDoc_STR("() -> (SInt32 _rv)")},
378 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
379 PyDoc_STR("() -> (Point _rv)")},
380 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
381 PyDoc_STR("(Point inObjectSize) -> None")},
382 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
383 PyDoc_STR("() -> (LongRect outObjectFrame)")},
384 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
385 PyDoc_STR("() -> (SInt32 _rv)")},
386 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
387 PyDoc_STR("(SInt32 inRefCon) -> None")},
388 {NULL, NULL, 0}
391 #define WEOObj_getsetlist NULL
394 #define WEOObj_compare NULL
396 #define WEOObj_repr NULL
398 #define WEOObj_hash NULL
399 #define WEOObj_tp_init 0
401 #define WEOObj_tp_alloc PyType_GenericAlloc
403 static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
405 PyObject *self;
406 WEObjectReference itself;
407 char *kw[] = {"itself", 0};
409 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
410 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
411 ((WEOObject *)self)->ob_itself = itself;
412 return self;
415 #define WEOObj_tp_free PyObject_Del
418 PyTypeObject WEO_Type = {
419 PyObject_HEAD_INIT(NULL)
420 0, /*ob_size*/
421 "waste.WEO", /*tp_name*/
422 sizeof(WEOObject), /*tp_basicsize*/
423 0, /*tp_itemsize*/
424 /* methods */
425 (destructor) WEOObj_dealloc, /*tp_dealloc*/
426 0, /*tp_print*/
427 (getattrfunc)0, /*tp_getattr*/
428 (setattrfunc)0, /*tp_setattr*/
429 (cmpfunc) WEOObj_compare, /*tp_compare*/
430 (reprfunc) WEOObj_repr, /*tp_repr*/
431 (PyNumberMethods *)0, /* tp_as_number */
432 (PySequenceMethods *)0, /* tp_as_sequence */
433 (PyMappingMethods *)0, /* tp_as_mapping */
434 (hashfunc) WEOObj_hash, /*tp_hash*/
435 0, /*tp_call*/
436 0, /*tp_str*/
437 PyObject_GenericGetAttr, /*tp_getattro*/
438 PyObject_GenericSetAttr, /*tp_setattro */
439 0, /*tp_as_buffer*/
440 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
441 0, /*tp_doc*/
442 0, /*tp_traverse*/
443 0, /*tp_clear*/
444 0, /*tp_richcompare*/
445 0, /*tp_weaklistoffset*/
446 0, /*tp_iter*/
447 0, /*tp_iternext*/
448 WEOObj_methods, /* tp_methods */
449 0, /*tp_members*/
450 WEOObj_getsetlist, /*tp_getset*/
451 0, /*tp_base*/
452 0, /*tp_dict*/
453 0, /*tp_descr_get*/
454 0, /*tp_descr_set*/
455 0, /*tp_dictoffset*/
456 WEOObj_tp_init, /* tp_init */
457 WEOObj_tp_alloc, /* tp_alloc */
458 WEOObj_tp_new, /* tp_new */
459 WEOObj_tp_free, /* tp_free */
462 /* ---------------------- End object type WEO ----------------------- */
465 /* ----------------------- Object type waste ------------------------ */
467 PyTypeObject waste_Type;
469 #define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
471 typedef struct wasteObject {
472 PyObject_HEAD
473 WEReference ob_itself;
474 } wasteObject;
476 PyObject *wasteObj_New(WEReference itself)
478 wasteObject *it;
479 if (itself == NULL) {
480 PyErr_SetString(waste_Error,"Cannot create null WE");
481 return NULL;
483 it = PyObject_NEW(wasteObject, &waste_Type);
484 if (it == NULL) return NULL;
485 it->ob_itself = itself;
486 WESetInfo(weRefCon, (void *)&it, itself);
487 return (PyObject *)it;
489 int wasteObj_Convert(PyObject *v, WEReference *p_itself)
491 if (!wasteObj_Check(v))
493 PyErr_SetString(PyExc_TypeError, "waste required");
494 return 0;
496 *p_itself = ((wasteObject *)v)->ob_itself;
497 return 1;
500 static void wasteObj_dealloc(wasteObject *self)
502 WEDispose(self->ob_itself);
503 self->ob_type->tp_free((PyObject *)self);
506 static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
508 PyObject *_res = NULL;
509 Handle _rv;
510 if (!PyArg_ParseTuple(_args, ""))
511 return NULL;
512 _rv = WEGetText(_self->ob_itself);
513 _res = Py_BuildValue("O&",
514 ResObj_New, _rv);
515 return _res;
518 static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
520 PyObject *_res = NULL;
521 SInt16 _rv;
522 SInt32 inOffset;
523 if (!PyArg_ParseTuple(_args, "l",
524 &inOffset))
525 return NULL;
526 _rv = WEGetChar(inOffset,
527 _self->ob_itself);
528 _res = Py_BuildValue("h",
529 _rv);
530 return _res;
533 static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
535 PyObject *_res = NULL;
536 SInt32 _rv;
537 if (!PyArg_ParseTuple(_args, ""))
538 return NULL;
539 _rv = WEGetTextLength(_self->ob_itself);
540 _res = Py_BuildValue("l",
541 _rv);
542 return _res;
545 static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
547 PyObject *_res = NULL;
548 SInt32 outSelStart;
549 SInt32 outSelEnd;
550 if (!PyArg_ParseTuple(_args, ""))
551 return NULL;
552 WEGetSelection(&outSelStart,
553 &outSelEnd,
554 _self->ob_itself);
555 _res = Py_BuildValue("ll",
556 outSelStart,
557 outSelEnd);
558 return _res;
561 static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
563 PyObject *_res = NULL;
564 LongRect outDestRect;
565 if (!PyArg_ParseTuple(_args, ""))
566 return NULL;
567 WEGetDestRect(&outDestRect,
568 _self->ob_itself);
569 _res = Py_BuildValue("O&",
570 LongRect_New, &outDestRect);
571 return _res;
574 static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
576 PyObject *_res = NULL;
577 LongRect outViewRect;
578 if (!PyArg_ParseTuple(_args, ""))
579 return NULL;
580 WEGetViewRect(&outViewRect,
581 _self->ob_itself);
582 _res = Py_BuildValue("O&",
583 LongRect_New, &outViewRect);
584 return _res;
587 static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
589 PyObject *_res = NULL;
590 Boolean _rv;
591 if (!PyArg_ParseTuple(_args, ""))
592 return NULL;
593 _rv = WEIsActive(_self->ob_itself);
594 _res = Py_BuildValue("b",
595 _rv);
596 return _res;
599 static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
601 PyObject *_res = NULL;
602 UInt16 _rv;
603 if (!PyArg_ParseTuple(_args, ""))
604 return NULL;
605 _rv = WEGetClickCount(_self->ob_itself);
606 _res = Py_BuildValue("H",
607 _rv);
608 return _res;
611 static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
613 PyObject *_res = NULL;
614 SInt32 inSelStart;
615 SInt32 inSelEnd;
616 if (!PyArg_ParseTuple(_args, "ll",
617 &inSelStart,
618 &inSelEnd))
619 return NULL;
620 WESetSelection(inSelStart,
621 inSelEnd,
622 _self->ob_itself);
623 Py_INCREF(Py_None);
624 _res = Py_None;
625 return _res;
628 static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
630 PyObject *_res = NULL;
631 LongRect inDestRect;
632 if (!PyArg_ParseTuple(_args, "O&",
633 LongRect_Convert, &inDestRect))
634 return NULL;
635 WESetDestRect(&inDestRect,
636 _self->ob_itself);
637 Py_INCREF(Py_None);
638 _res = Py_None;
639 return _res;
642 static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
644 PyObject *_res = NULL;
645 LongRect inViewRect;
646 if (!PyArg_ParseTuple(_args, "O&",
647 LongRect_Convert, &inViewRect))
648 return NULL;
649 WESetViewRect(&inViewRect,
650 _self->ob_itself);
651 Py_INCREF(Py_None);
652 _res = Py_None;
653 return _res;
656 static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
658 PyObject *_res = NULL;
659 Boolean _rv;
660 WEStyleMode ioMode;
661 TextStyle outTextStyle;
662 if (!PyArg_ParseTuple(_args, "H",
663 &ioMode))
664 return NULL;
665 _rv = WEContinuousStyle(&ioMode,
666 &outTextStyle,
667 _self->ob_itself);
668 _res = Py_BuildValue("bHO&",
669 _rv,
670 ioMode,
671 TextStyle_New, &outTextStyle);
672 return _res;
675 static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
677 PyObject *_res = NULL;
678 SInt32 _rv;
679 if (!PyArg_ParseTuple(_args, ""))
680 return NULL;
681 _rv = WECountRuns(_self->ob_itself);
682 _res = Py_BuildValue("l",
683 _rv);
684 return _res;
687 static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
689 PyObject *_res = NULL;
690 SInt32 _rv;
691 SInt32 inOffset;
692 if (!PyArg_ParseTuple(_args, "l",
693 &inOffset))
694 return NULL;
695 _rv = WEOffsetToRun(inOffset,
696 _self->ob_itself);
697 _res = Py_BuildValue("l",
698 _rv);
699 return _res;
702 static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
704 PyObject *_res = NULL;
705 SInt32 inStyleRunIndex;
706 SInt32 outStyleRunStart;
707 SInt32 outStyleRunEnd;
708 if (!PyArg_ParseTuple(_args, "l",
709 &inStyleRunIndex))
710 return NULL;
711 WEGetRunRange(inStyleRunIndex,
712 &outStyleRunStart,
713 &outStyleRunEnd,
714 _self->ob_itself);
715 _res = Py_BuildValue("ll",
716 outStyleRunStart,
717 outStyleRunEnd);
718 return _res;
721 static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
723 PyObject *_res = NULL;
724 SInt32 inOffset;
725 WERunInfo outStyleRunInfo;
726 if (!PyArg_ParseTuple(_args, "l",
727 &inOffset))
728 return NULL;
729 WEGetRunInfo(inOffset,
730 &outStyleRunInfo,
731 _self->ob_itself);
732 _res = Py_BuildValue("O&",
733 RunInfo_New, &outStyleRunInfo);
734 return _res;
737 static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
739 PyObject *_res = NULL;
740 SInt32 inStyleRunIndex;
741 WERunInfo outStyleRunInfo;
742 if (!PyArg_ParseTuple(_args, "l",
743 &inStyleRunIndex))
744 return NULL;
745 WEGetIndRunInfo(inStyleRunIndex,
746 &outStyleRunInfo,
747 _self->ob_itself);
748 _res = Py_BuildValue("O&",
749 RunInfo_New, &outStyleRunInfo);
750 return _res;
753 static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
755 PyObject *_res = NULL;
756 Boolean _rv;
757 SInt32 inOffset;
758 if (!PyArg_ParseTuple(_args, "l",
759 &inOffset))
760 return NULL;
761 _rv = WEGetRunDirection(inOffset,
762 _self->ob_itself);
763 _res = Py_BuildValue("b",
764 _rv);
765 return _res;
768 static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
770 PyObject *_res = NULL;
771 SInt32 _rv;
772 if (!PyArg_ParseTuple(_args, ""))
773 return NULL;
774 _rv = WECountParaRuns(_self->ob_itself);
775 _res = Py_BuildValue("l",
776 _rv);
777 return _res;
780 static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
782 PyObject *_res = NULL;
783 SInt32 _rv;
784 SInt32 inOffset;
785 if (!PyArg_ParseTuple(_args, "l",
786 &inOffset))
787 return NULL;
788 _rv = WEOffsetToParaRun(inOffset,
789 _self->ob_itself);
790 _res = Py_BuildValue("l",
791 _rv);
792 return _res;
795 static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
797 PyObject *_res = NULL;
798 SInt32 inParagraphRunIndex;
799 SInt32 outParagraphRunStart;
800 SInt32 outParagraphRunEnd;
801 if (!PyArg_ParseTuple(_args, "l",
802 &inParagraphRunIndex))
803 return NULL;
804 WEGetParaRunRange(inParagraphRunIndex,
805 &outParagraphRunStart,
806 &outParagraphRunEnd,
807 _self->ob_itself);
808 _res = Py_BuildValue("ll",
809 outParagraphRunStart,
810 outParagraphRunEnd);
811 return _res;
814 static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
816 PyObject *_res = NULL;
817 SInt32 _rv;
818 if (!PyArg_ParseTuple(_args, ""))
819 return NULL;
820 _rv = WECountLines(_self->ob_itself);
821 _res = Py_BuildValue("l",
822 _rv);
823 return _res;
826 static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
828 PyObject *_res = NULL;
829 SInt32 _rv;
830 SInt32 inOffset;
831 if (!PyArg_ParseTuple(_args, "l",
832 &inOffset))
833 return NULL;
834 _rv = WEOffsetToLine(inOffset,
835 _self->ob_itself);
836 _res = Py_BuildValue("l",
837 _rv);
838 return _res;
841 static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
843 PyObject *_res = NULL;
844 SInt32 inLineIndex;
845 SInt32 outLineStart;
846 SInt32 outLineEnd;
847 if (!PyArg_ParseTuple(_args, "l",
848 &inLineIndex))
849 return NULL;
850 WEGetLineRange(inLineIndex,
851 &outLineStart,
852 &outLineEnd,
853 _self->ob_itself);
854 _res = Py_BuildValue("ll",
855 outLineStart,
856 outLineEnd);
857 return _res;
860 static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
862 PyObject *_res = NULL;
863 SInt32 _rv;
864 SInt32 inStartLineIndex;
865 SInt32 inEndLineIndex;
866 if (!PyArg_ParseTuple(_args, "ll",
867 &inStartLineIndex,
868 &inEndLineIndex))
869 return NULL;
870 _rv = WEGetHeight(inStartLineIndex,
871 inEndLineIndex,
872 _self->ob_itself);
873 _res = Py_BuildValue("l",
874 _rv);
875 return _res;
878 static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
880 PyObject *_res = NULL;
881 SInt32 _rv;
882 LongPt inPoint;
883 WEEdge outEdge;
884 if (!PyArg_ParseTuple(_args, "O&",
885 LongPt_Convert, &inPoint))
886 return NULL;
887 _rv = WEGetOffset(&inPoint,
888 &outEdge,
889 _self->ob_itself);
890 _res = Py_BuildValue("lB",
891 _rv,
892 outEdge);
893 return _res;
896 static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
898 PyObject *_res = NULL;
899 SInt32 inOffset;
900 SInt16 inDirection;
901 LongPt outPoint;
902 SInt16 outLineHeight;
903 if (!PyArg_ParseTuple(_args, "lh",
904 &inOffset,
905 &inDirection))
906 return NULL;
907 WEGetPoint(inOffset,
908 inDirection,
909 &outPoint,
910 &outLineHeight,
911 _self->ob_itself);
912 _res = Py_BuildValue("O&h",
913 LongPt_New, &outPoint,
914 outLineHeight);
915 return _res;
918 static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
920 PyObject *_res = NULL;
921 SInt32 inOffset;
922 WEEdge inEdge;
923 SInt32 outWordStart;
924 SInt32 outWordEnd;
925 if (!PyArg_ParseTuple(_args, "lB",
926 &inOffset,
927 &inEdge))
928 return NULL;
929 WEFindWord(inOffset,
930 inEdge,
931 &outWordStart,
932 &outWordEnd,
933 _self->ob_itself);
934 _res = Py_BuildValue("ll",
935 outWordStart,
936 outWordEnd);
937 return _res;
940 static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
942 PyObject *_res = NULL;
943 SInt32 inOffset;
944 WEEdge inEdge;
945 SInt32 outLineStart;
946 SInt32 outLineEnd;
947 if (!PyArg_ParseTuple(_args, "lB",
948 &inOffset,
949 &inEdge))
950 return NULL;
951 WEFindLine(inOffset,
952 inEdge,
953 &outLineStart,
954 &outLineEnd,
955 _self->ob_itself);
956 _res = Py_BuildValue("ll",
957 outLineStart,
958 outLineEnd);
959 return _res;
962 static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
964 PyObject *_res = NULL;
965 SInt32 inOffset;
966 WEEdge inEdge;
967 SInt32 outParagraphStart;
968 SInt32 outParagraphEnd;
969 if (!PyArg_ParseTuple(_args, "lB",
970 &inOffset,
971 &inEdge))
972 return NULL;
973 WEFindParagraph(inOffset,
974 inEdge,
975 &outParagraphStart,
976 &outParagraphEnd,
977 _self->ob_itself);
978 _res = Py_BuildValue("ll",
979 outParagraphStart,
980 outParagraphEnd);
981 return _res;
984 static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
986 PyObject *_res = NULL;
987 OSErr _err;
988 char* inKey;
989 SInt32 inKeyLength;
990 TextEncoding inKeyEncoding;
991 OptionBits inMatchOptions;
992 SInt32 inRangeStart;
993 SInt32 inRangeEnd;
994 SInt32 outMatchStart;
995 SInt32 outMatchEnd;
996 if (!PyArg_ParseTuple(_args, "slllll",
997 &inKey,
998 &inKeyLength,
999 &inKeyEncoding,
1000 &inMatchOptions,
1001 &inRangeStart,
1002 &inRangeEnd))
1003 return NULL;
1004 _err = WEFind(inKey,
1005 inKeyLength,
1006 inKeyEncoding,
1007 inMatchOptions,
1008 inRangeStart,
1009 inRangeEnd,
1010 &outMatchStart,
1011 &outMatchEnd,
1012 _self->ob_itself);
1013 if (_err != noErr) return PyMac_Error(_err);
1014 _res = Py_BuildValue("ll",
1015 outMatchStart,
1016 outMatchEnd);
1017 return _res;
1020 static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
1022 PyObject *_res = NULL;
1023 OSErr _err;
1024 SInt32 inRangeStart;
1025 SInt32 inRangeEnd;
1026 FlavorType inRequestedType;
1027 OptionBits inStreamOptions;
1028 Handle outData;
1029 if (!PyArg_ParseTuple(_args, "llO&lO&",
1030 &inRangeStart,
1031 &inRangeEnd,
1032 PyMac_GetOSType, &inRequestedType,
1033 &inStreamOptions,
1034 ResObj_Convert, &outData))
1035 return NULL;
1036 _err = WEStreamRange(inRangeStart,
1037 inRangeEnd,
1038 inRequestedType,
1039 inStreamOptions,
1040 outData,
1041 _self->ob_itself);
1042 if (_err != noErr) return PyMac_Error(_err);
1043 Py_INCREF(Py_None);
1044 _res = Py_None;
1045 return _res;
1048 static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
1050 PyObject *_res = NULL;
1051 OSErr _err;
1052 SInt32 inRangeStart;
1053 SInt32 inRangeEnd;
1054 Handle outText;
1055 StScrpHandle outStyles;
1056 WESoupHandle outSoup;
1057 if (!PyArg_ParseTuple(_args, "llO&O&O&",
1058 &inRangeStart,
1059 &inRangeEnd,
1060 OptResObj_Convert, &outText,
1061 OptResObj_Convert, &outStyles,
1062 OptResObj_Convert, &outSoup))
1063 return NULL;
1064 _err = WECopyRange(inRangeStart,
1065 inRangeEnd,
1066 outText,
1067 outStyles,
1068 outSoup,
1069 _self->ob_itself);
1070 if (_err != noErr) return PyMac_Error(_err);
1071 Py_INCREF(Py_None);
1072 _res = Py_None;
1073 return _res;
1076 static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1078 PyObject *_res = NULL;
1079 OSErr _err;
1080 SInt32 inRangeStart;
1081 SInt32 inRangeEnd;
1082 Handle outUnicodeText;
1083 Handle ioCharFormat;
1084 Handle ioParaFormat;
1085 TextEncodingVariant inUnicodeVariant;
1086 TextEncodingFormat inTransformationFormat;
1087 OptionBits inGetOptions;
1088 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1089 &inRangeStart,
1090 &inRangeEnd,
1091 ResObj_Convert, &outUnicodeText,
1092 ResObj_Convert, &ioCharFormat,
1093 ResObj_Convert, &ioParaFormat,
1094 &inUnicodeVariant,
1095 &inTransformationFormat,
1096 &inGetOptions))
1097 return NULL;
1098 _err = WEGetTextRangeAsUnicode(inRangeStart,
1099 inRangeEnd,
1100 outUnicodeText,
1101 ioCharFormat,
1102 ioParaFormat,
1103 inUnicodeVariant,
1104 inTransformationFormat,
1105 inGetOptions,
1106 _self->ob_itself);
1107 if (_err != noErr) return PyMac_Error(_err);
1108 Py_INCREF(Py_None);
1109 _res = Py_None;
1110 return _res;
1113 static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
1115 PyObject *_res = NULL;
1116 WEAlignment _rv;
1117 if (!PyArg_ParseTuple(_args, ""))
1118 return NULL;
1119 _rv = WEGetAlignment(_self->ob_itself);
1120 _res = Py_BuildValue("B",
1121 _rv);
1122 return _res;
1125 static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
1127 PyObject *_res = NULL;
1128 WEAlignment inAlignment;
1129 if (!PyArg_ParseTuple(_args, "B",
1130 &inAlignment))
1131 return NULL;
1132 WESetAlignment(inAlignment,
1133 _self->ob_itself);
1134 Py_INCREF(Py_None);
1135 _res = Py_None;
1136 return _res;
1139 static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
1141 PyObject *_res = NULL;
1142 WEDirection _rv;
1143 if (!PyArg_ParseTuple(_args, ""))
1144 return NULL;
1145 _rv = WEGetDirection(_self->ob_itself);
1146 _res = Py_BuildValue("h",
1147 _rv);
1148 return _res;
1151 static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
1153 PyObject *_res = NULL;
1154 WEDirection inDirection;
1155 if (!PyArg_ParseTuple(_args, "h",
1156 &inDirection))
1157 return NULL;
1158 WESetDirection(inDirection,
1159 _self->ob_itself);
1160 Py_INCREF(Py_None);
1161 _res = Py_None;
1162 return _res;
1165 static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
1167 PyObject *_res = NULL;
1168 OSErr _err;
1169 if (!PyArg_ParseTuple(_args, ""))
1170 return NULL;
1171 _err = WECalText(_self->ob_itself);
1172 if (_err != noErr) return PyMac_Error(_err);
1173 Py_INCREF(Py_None);
1174 _res = Py_None;
1175 return _res;
1178 static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
1180 PyObject *_res = NULL;
1181 RgnHandle inUpdateRgn;
1182 if (!PyArg_ParseTuple(_args, "O&",
1183 ResObj_Convert, &inUpdateRgn))
1184 return NULL;
1185 WEUpdate(inUpdateRgn,
1186 _self->ob_itself);
1187 Py_INCREF(Py_None);
1188 _res = Py_None;
1189 return _res;
1192 static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
1194 PyObject *_res = NULL;
1195 SInt32 inHorizontalOffset;
1196 SInt32 inVerticalOffset;
1197 if (!PyArg_ParseTuple(_args, "ll",
1198 &inHorizontalOffset,
1199 &inVerticalOffset))
1200 return NULL;
1201 WEScroll(inHorizontalOffset,
1202 inVerticalOffset,
1203 _self->ob_itself);
1204 Py_INCREF(Py_None);
1205 _res = Py_None;
1206 return _res;
1209 static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1211 PyObject *_res = NULL;
1212 SInt32 inHorizontalOffset;
1213 SInt32 inVerticalOffset;
1214 if (!PyArg_ParseTuple(_args, "ll",
1215 &inHorizontalOffset,
1216 &inVerticalOffset))
1217 return NULL;
1218 WEPinScroll(inHorizontalOffset,
1219 inVerticalOffset,
1220 _self->ob_itself);
1221 Py_INCREF(Py_None);
1222 _res = Py_None;
1223 return _res;
1226 static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
1228 PyObject *_res = NULL;
1229 if (!PyArg_ParseTuple(_args, ""))
1230 return NULL;
1231 WESelView(_self->ob_itself);
1232 Py_INCREF(Py_None);
1233 _res = Py_None;
1234 return _res;
1237 static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
1239 PyObject *_res = NULL;
1240 if (!PyArg_ParseTuple(_args, ""))
1241 return NULL;
1242 WEActivate(_self->ob_itself);
1243 Py_INCREF(Py_None);
1244 _res = Py_None;
1245 return _res;
1248 static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
1250 PyObject *_res = NULL;
1251 if (!PyArg_ParseTuple(_args, ""))
1252 return NULL;
1253 WEDeactivate(_self->ob_itself);
1254 Py_INCREF(Py_None);
1255 _res = Py_None;
1256 return _res;
1259 static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
1261 PyObject *_res = NULL;
1262 CharParameter inKey;
1263 EventModifiers inModifiers;
1264 if (!PyArg_ParseTuple(_args, "hH",
1265 &inKey,
1266 &inModifiers))
1267 return NULL;
1268 WEKey(inKey,
1269 inModifiers,
1270 _self->ob_itself);
1271 Py_INCREF(Py_None);
1272 _res = Py_None;
1273 return _res;
1276 static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
1278 PyObject *_res = NULL;
1279 Point inHitPoint;
1280 EventModifiers inModifiers;
1281 UInt32 inClickTime;
1282 if (!PyArg_ParseTuple(_args, "O&Hl",
1283 PyMac_GetPoint, &inHitPoint,
1284 &inModifiers,
1285 &inClickTime))
1286 return NULL;
1287 WEClick(inHitPoint,
1288 inModifiers,
1289 inClickTime,
1290 _self->ob_itself);
1291 Py_INCREF(Py_None);
1292 _res = Py_None;
1293 return _res;
1296 static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
1298 PyObject *_res = NULL;
1299 Boolean _rv;
1300 Point inMouseLoc;
1301 RgnHandle ioMouseRgn;
1302 if (!PyArg_ParseTuple(_args, "O&O&",
1303 PyMac_GetPoint, &inMouseLoc,
1304 ResObj_Convert, &ioMouseRgn))
1305 return NULL;
1306 _rv = WEAdjustCursor(inMouseLoc,
1307 ioMouseRgn,
1308 _self->ob_itself);
1309 _res = Py_BuildValue("b",
1310 _rv);
1311 return _res;
1314 static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
1316 PyObject *_res = NULL;
1317 UInt32 outMaxSleep;
1318 if (!PyArg_ParseTuple(_args, ""))
1319 return NULL;
1320 WEIdle(&outMaxSleep,
1321 _self->ob_itself);
1322 _res = Py_BuildValue("l",
1323 outMaxSleep);
1324 return _res;
1327 static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
1329 PyObject *_res = NULL;
1330 OSErr _err;
1331 char *inTextPtr__in__;
1332 long inTextPtr__len__;
1333 int inTextPtr__in_len__;
1334 StScrpHandle inStyles;
1335 WESoupHandle inSoup;
1336 if (!PyArg_ParseTuple(_args, "s#O&O&",
1337 &inTextPtr__in__, &inTextPtr__in_len__,
1338 OptResObj_Convert, &inStyles,
1339 OptResObj_Convert, &inSoup))
1340 return NULL;
1341 inTextPtr__len__ = inTextPtr__in_len__;
1342 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1343 inStyles,
1344 inSoup,
1345 _self->ob_itself);
1346 if (_err != noErr) return PyMac_Error(_err);
1347 Py_INCREF(Py_None);
1348 _res = Py_None;
1349 return _res;
1352 static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1354 PyObject *_res = NULL;
1355 OSErr _err;
1356 char *inTextPtr__in__;
1357 long inTextPtr__len__;
1358 int inTextPtr__in_len__;
1359 StScrpHandle inStyles;
1360 WESoupHandle inSoup;
1361 Handle inParaFormat;
1362 Handle inRulerScrap;
1363 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1364 &inTextPtr__in__, &inTextPtr__in_len__,
1365 OptResObj_Convert, &inStyles,
1366 OptResObj_Convert, &inSoup,
1367 ResObj_Convert, &inParaFormat,
1368 ResObj_Convert, &inRulerScrap))
1369 return NULL;
1370 inTextPtr__len__ = inTextPtr__in_len__;
1371 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1372 inStyles,
1373 inSoup,
1374 inParaFormat,
1375 inRulerScrap,
1376 _self->ob_itself);
1377 if (_err != noErr) return PyMac_Error(_err);
1378 Py_INCREF(Py_None);
1379 _res = Py_None;
1380 return _res;
1383 static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
1385 PyObject *_res = NULL;
1386 OSErr _err;
1387 if (!PyArg_ParseTuple(_args, ""))
1388 return NULL;
1389 _err = WEDelete(_self->ob_itself);
1390 if (_err != noErr) return PyMac_Error(_err);
1391 Py_INCREF(Py_None);
1392 _res = Py_None;
1393 return _res;
1396 static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1398 PyObject *_res = NULL;
1399 OSErr _err;
1400 Handle inText;
1401 if (!PyArg_ParseTuple(_args, "O&",
1402 ResObj_Convert, &inText))
1403 return NULL;
1404 _err = WEUseText(inText,
1405 _self->ob_itself);
1406 if (_err != noErr) return PyMac_Error(_err);
1407 Py_INCREF(Py_None);
1408 _res = Py_None;
1409 return _res;
1412 static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1414 PyObject *_res = NULL;
1415 OSErr _err;
1416 SInt16 inCase;
1417 if (!PyArg_ParseTuple(_args, "h",
1418 &inCase))
1419 return NULL;
1420 _err = WEChangeCase(inCase,
1421 _self->ob_itself);
1422 if (_err != noErr) return PyMac_Error(_err);
1423 Py_INCREF(Py_None);
1424 _res = Py_None;
1425 return _res;
1428 static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1430 PyObject *_res = NULL;
1431 OSErr _err;
1432 SInt32 inRangeStart;
1433 SInt32 inRangeEnd;
1434 WESelector inAttributeSelector;
1435 char *inAttributeValue__in__;
1436 long inAttributeValue__len__;
1437 int inAttributeValue__in_len__;
1438 if (!PyArg_ParseTuple(_args, "llO&s#",
1439 &inRangeStart,
1440 &inRangeEnd,
1441 PyMac_GetOSType, &inAttributeSelector,
1442 &inAttributeValue__in__, &inAttributeValue__in_len__))
1443 return NULL;
1444 inAttributeValue__len__ = inAttributeValue__in_len__;
1445 _err = WESetOneAttribute(inRangeStart,
1446 inRangeEnd,
1447 inAttributeSelector,
1448 inAttributeValue__in__, inAttributeValue__len__,
1449 _self->ob_itself);
1450 if (_err != noErr) return PyMac_Error(_err);
1451 Py_INCREF(Py_None);
1452 _res = Py_None;
1453 return _res;
1456 static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
1458 PyObject *_res = NULL;
1459 OSErr _err;
1460 WEStyleMode inMode;
1461 TextStyle inTextStyle;
1462 if (!PyArg_ParseTuple(_args, "HO&",
1463 &inMode,
1464 TextStyle_Convert, &inTextStyle))
1465 return NULL;
1466 _err = WESetStyle(inMode,
1467 &inTextStyle,
1468 _self->ob_itself);
1469 if (_err != noErr) return PyMac_Error(_err);
1470 Py_INCREF(Py_None);
1471 _res = Py_None;
1472 return _res;
1475 static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
1477 PyObject *_res = NULL;
1478 OSErr _err;
1479 StScrpHandle inStyles;
1480 if (!PyArg_ParseTuple(_args, "O&",
1481 ResObj_Convert, &inStyles))
1482 return NULL;
1483 _err = WEUseStyleScrap(inStyles,
1484 _self->ob_itself);
1485 if (_err != noErr) return PyMac_Error(_err);
1486 Py_INCREF(Py_None);
1487 _res = Py_None;
1488 return _res;
1491 static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
1493 PyObject *_res = NULL;
1494 OSErr _err;
1495 if (!PyArg_ParseTuple(_args, ""))
1496 return NULL;
1497 _err = WEUndo(_self->ob_itself);
1498 if (_err != noErr) return PyMac_Error(_err);
1499 Py_INCREF(Py_None);
1500 _res = Py_None;
1501 return _res;
1504 static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1506 PyObject *_res = NULL;
1507 OSErr _err;
1508 if (!PyArg_ParseTuple(_args, ""))
1509 return NULL;
1510 _err = WERedo(_self->ob_itself);
1511 if (_err != noErr) return PyMac_Error(_err);
1512 Py_INCREF(Py_None);
1513 _res = Py_None;
1514 return _res;
1517 static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
1519 PyObject *_res = NULL;
1520 if (!PyArg_ParseTuple(_args, ""))
1521 return NULL;
1522 WEClearUndo(_self->ob_itself);
1523 Py_INCREF(Py_None);
1524 _res = Py_None;
1525 return _res;
1528 static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
1530 PyObject *_res = NULL;
1531 WEActionKind _rv;
1532 Boolean outRedoFlag;
1533 if (!PyArg_ParseTuple(_args, ""))
1534 return NULL;
1535 _rv = WEGetUndoInfo(&outRedoFlag,
1536 _self->ob_itself);
1537 _res = Py_BuildValue("hb",
1538 _rv,
1539 outRedoFlag);
1540 return _res;
1543 static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1545 PyObject *_res = NULL;
1546 WEActionKind _rv;
1547 SInt32 inUndoLevel;
1548 if (!PyArg_ParseTuple(_args, "l",
1549 &inUndoLevel))
1550 return NULL;
1551 _rv = WEGetIndUndoInfo(inUndoLevel,
1552 _self->ob_itself);
1553 _res = Py_BuildValue("h",
1554 _rv);
1555 return _res;
1558 static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
1560 PyObject *_res = NULL;
1561 Boolean _rv;
1562 if (!PyArg_ParseTuple(_args, ""))
1563 return NULL;
1564 _rv = WEIsTyping(_self->ob_itself);
1565 _res = Py_BuildValue("b",
1566 _rv);
1567 return _res;
1570 static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
1572 PyObject *_res = NULL;
1573 OSErr _err;
1574 if (!PyArg_ParseTuple(_args, ""))
1575 return NULL;
1576 _err = WEBeginAction(_self->ob_itself);
1577 if (_err != noErr) return PyMac_Error(_err);
1578 Py_INCREF(Py_None);
1579 _res = Py_None;
1580 return _res;
1583 static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
1585 PyObject *_res = NULL;
1586 OSErr _err;
1587 WEActionKind inActionKind;
1588 if (!PyArg_ParseTuple(_args, "h",
1589 &inActionKind))
1590 return NULL;
1591 _err = WEEndAction(inActionKind,
1592 _self->ob_itself);
1593 if (_err != noErr) return PyMac_Error(_err);
1594 Py_INCREF(Py_None);
1595 _res = Py_None;
1596 return _res;
1599 static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
1601 PyObject *_res = NULL;
1602 UInt32 _rv;
1603 if (!PyArg_ParseTuple(_args, ""))
1604 return NULL;
1605 _rv = WEGetModCount(_self->ob_itself);
1606 _res = Py_BuildValue("l",
1607 _rv);
1608 return _res;
1611 static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
1613 PyObject *_res = NULL;
1614 if (!PyArg_ParseTuple(_args, ""))
1615 return NULL;
1616 WEResetModCount(_self->ob_itself);
1617 Py_INCREF(Py_None);
1618 _res = Py_None;
1619 return _res;
1622 static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
1624 PyObject *_res = NULL;
1625 OSErr _err;
1626 FlavorType inObjectType;
1627 Handle inObjectDataHandle;
1628 Point inObjectSize;
1629 if (!PyArg_ParseTuple(_args, "O&O&O&",
1630 PyMac_GetOSType, &inObjectType,
1631 ResObj_Convert, &inObjectDataHandle,
1632 PyMac_GetPoint, &inObjectSize))
1633 return NULL;
1634 _err = WEInsertObject(inObjectType,
1635 inObjectDataHandle,
1636 inObjectSize,
1637 _self->ob_itself);
1638 if (_err != noErr) return PyMac_Error(_err);
1639 Py_INCREF(Py_None);
1640 _res = Py_None;
1641 return _res;
1644 static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
1646 PyObject *_res = NULL;
1647 OSErr _err;
1648 WEObjectReference outObject;
1649 if (!PyArg_ParseTuple(_args, ""))
1650 return NULL;
1651 _err = WEGetSelectedObject(&outObject,
1652 _self->ob_itself);
1653 if (_err != noErr) return PyMac_Error(_err);
1654 _res = Py_BuildValue("O&",
1655 WEOObj_New, outObject);
1656 return _res;
1659 static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1661 PyObject *_res = NULL;
1662 OSErr _err;
1663 SInt32 inOffset;
1664 WEObjectReference outObject;
1665 if (!PyArg_ParseTuple(_args, "l",
1666 &inOffset))
1667 return NULL;
1668 _err = WEGetObjectAtOffset(inOffset,
1669 &outObject,
1670 _self->ob_itself);
1671 if (_err != noErr) return PyMac_Error(_err);
1672 _res = Py_BuildValue("O&",
1673 WEOObj_New, outObject);
1674 return _res;
1677 static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
1679 PyObject *_res = NULL;
1680 SInt32 _rv;
1681 SInt32 inOffset;
1682 WEObjectReference outObject;
1683 if (!PyArg_ParseTuple(_args, "l",
1684 &inOffset))
1685 return NULL;
1686 _rv = WEFindNextObject(inOffset,
1687 &outObject,
1688 _self->ob_itself);
1689 _res = Py_BuildValue("lO&",
1690 _rv,
1691 WEOObj_New, outObject);
1692 return _res;
1695 static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
1697 PyObject *_res = NULL;
1698 OSErr _err;
1699 WESoupHandle inSoup;
1700 if (!PyArg_ParseTuple(_args, "O&",
1701 ResObj_Convert, &inSoup))
1702 return NULL;
1703 _err = WEUseSoup(inSoup,
1704 _self->ob_itself);
1705 if (_err != noErr) return PyMac_Error(_err);
1706 Py_INCREF(Py_None);
1707 _res = Py_None;
1708 return _res;
1711 static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
1713 PyObject *_res = NULL;
1714 OSErr _err;
1715 if (!PyArg_ParseTuple(_args, ""))
1716 return NULL;
1717 _err = WECut(_self->ob_itself);
1718 if (_err != noErr) return PyMac_Error(_err);
1719 Py_INCREF(Py_None);
1720 _res = Py_None;
1721 return _res;
1724 static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
1726 PyObject *_res = NULL;
1727 OSErr _err;
1728 if (!PyArg_ParseTuple(_args, ""))
1729 return NULL;
1730 _err = WECopy(_self->ob_itself);
1731 if (_err != noErr) return PyMac_Error(_err);
1732 Py_INCREF(Py_None);
1733 _res = Py_None;
1734 return _res;
1737 static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
1739 PyObject *_res = NULL;
1740 OSErr _err;
1741 if (!PyArg_ParseTuple(_args, ""))
1742 return NULL;
1743 _err = WEPaste(_self->ob_itself);
1744 if (_err != noErr) return PyMac_Error(_err);
1745 Py_INCREF(Py_None);
1746 _res = Py_None;
1747 return _res;
1750 static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
1752 PyObject *_res = NULL;
1753 Boolean _rv;
1754 if (!PyArg_ParseTuple(_args, ""))
1755 return NULL;
1756 _rv = WECanPaste(_self->ob_itself);
1757 _res = Py_BuildValue("b",
1758 _rv);
1759 return _res;
1762 static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
1764 PyObject *_res = NULL;
1765 RgnHandle _rv;
1766 SInt32 inRangeStart;
1767 SInt32 inRangeEnd;
1768 if (!PyArg_ParseTuple(_args, "ll",
1769 &inRangeStart,
1770 &inRangeEnd))
1771 return NULL;
1772 _rv = WEGetHiliteRgn(inRangeStart,
1773 inRangeEnd,
1774 _self->ob_itself);
1775 _res = Py_BuildValue("O&",
1776 ResObj_New, _rv);
1777 return _res;
1780 static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
1782 PyObject *_res = NULL;
1783 SInt16 _rv;
1784 SInt32 inOffset;
1785 if (!PyArg_ParseTuple(_args, "l",
1786 &inOffset))
1787 return NULL;
1788 _rv = WECharByte(inOffset,
1789 _self->ob_itself);
1790 _res = Py_BuildValue("h",
1791 _rv);
1792 return _res;
1795 static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
1797 PyObject *_res = NULL;
1798 SInt16 _rv;
1799 SInt32 inOffset;
1800 if (!PyArg_ParseTuple(_args, "l",
1801 &inOffset))
1802 return NULL;
1803 _rv = WECharType(inOffset,
1804 _self->ob_itself);
1805 _res = Py_BuildValue("h",
1806 _rv);
1807 return _res;
1810 static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
1812 PyObject *_res = NULL;
1813 if (!PyArg_ParseTuple(_args, ""))
1814 return NULL;
1815 WEStopInlineSession(_self->ob_itself);
1816 Py_INCREF(Py_None);
1817 _res = Py_None;
1818 return _res;
1821 static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
1823 PyObject *_res = NULL;
1824 SInt16 _rv;
1825 SInt16 inFeature;
1826 SInt16 inAction;
1827 if (!PyArg_ParseTuple(_args, "hh",
1828 &inFeature,
1829 &inAction))
1830 return NULL;
1831 _rv = WEFeatureFlag(inFeature,
1832 inAction,
1833 _self->ob_itself);
1834 _res = Py_BuildValue("h",
1835 _rv);
1836 return _res;
1839 static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
1841 PyObject *_res = NULL;
1842 OSErr _err;
1843 WESelector inUserTag;
1844 SInt32 outUserInfo;
1845 if (!PyArg_ParseTuple(_args, "O&",
1846 PyMac_GetOSType, &inUserTag))
1847 return NULL;
1848 _err = WEGetUserInfo(inUserTag,
1849 &outUserInfo,
1850 _self->ob_itself);
1851 if (_err != noErr) return PyMac_Error(_err);
1852 _res = Py_BuildValue("l",
1853 outUserInfo);
1854 return _res;
1857 static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
1859 PyObject *_res = NULL;
1860 OSErr _err;
1861 WESelector inUserTag;
1862 SInt32 inUserInfo;
1863 if (!PyArg_ParseTuple(_args, "O&l",
1864 PyMac_GetOSType, &inUserTag,
1865 &inUserInfo))
1866 return NULL;
1867 _err = WESetUserInfo(inUserTag,
1868 inUserInfo,
1869 _self->ob_itself);
1870 if (_err != noErr) return PyMac_Error(_err);
1871 Py_INCREF(Py_None);
1872 _res = Py_None;
1873 return _res;
1876 static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1878 PyObject *_res = NULL;
1879 OSErr _err;
1880 WESelector inUserTag;
1881 if (!PyArg_ParseTuple(_args, "O&",
1882 PyMac_GetOSType, &inUserTag))
1883 return NULL;
1884 _err = WERemoveUserInfo(inUserTag,
1885 _self->ob_itself);
1886 if (_err != noErr) return PyMac_Error(_err);
1887 Py_INCREF(Py_None);
1888 _res = Py_None;
1889 return _res;
1892 static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
1894 PyObject *_res = NULL;
1895 OSErr _err;
1896 if (!PyArg_ParseTuple(_args, ""))
1897 return NULL;
1898 _err = WEInstallTabHooks(_self->ob_itself);
1899 if (_err != noErr) return PyMac_Error(_err);
1900 Py_INCREF(Py_None);
1901 _res = Py_None;
1902 return _res;
1905 static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
1907 PyObject *_res = NULL;
1908 OSErr _err;
1909 if (!PyArg_ParseTuple(_args, ""))
1910 return NULL;
1911 _err = WERemoveTabHooks(_self->ob_itself);
1912 if (_err != noErr) return PyMac_Error(_err);
1913 Py_INCREF(Py_None);
1914 _res = Py_None;
1915 return _res;
1918 static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
1920 PyObject *_res = NULL;
1921 Boolean _rv;
1922 if (!PyArg_ParseTuple(_args, ""))
1923 return NULL;
1924 _rv = WEIsTabHooks(_self->ob_itself);
1925 _res = Py_BuildValue("b",
1926 _rv);
1927 return _res;
1930 static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
1932 PyObject *_res = NULL;
1933 SInt16 _rv;
1934 if (!PyArg_ParseTuple(_args, ""))
1935 return NULL;
1936 _rv = WEGetTabSize(_self->ob_itself);
1937 _res = Py_BuildValue("h",
1938 _rv);
1939 return _res;
1942 static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
1944 PyObject *_res = NULL;
1945 OSErr _err;
1946 SInt16 tabWidth;
1947 if (!PyArg_ParseTuple(_args, "h",
1948 &tabWidth))
1949 return NULL;
1950 _err = WESetTabSize(tabWidth,
1951 _self->ob_itself);
1952 if (_err != noErr) return PyMac_Error(_err);
1953 Py_INCREF(Py_None);
1954 _res = Py_None;
1955 return _res;
1958 static PyMethodDef wasteObj_methods[] = {
1959 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
1960 PyDoc_STR("() -> (Handle _rv)")},
1961 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
1962 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
1963 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
1964 PyDoc_STR("() -> (SInt32 _rv)")},
1965 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
1966 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
1967 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
1968 PyDoc_STR("() -> (LongRect outDestRect)")},
1969 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
1970 PyDoc_STR("() -> (LongRect outViewRect)")},
1971 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
1972 PyDoc_STR("() -> (Boolean _rv)")},
1973 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
1974 PyDoc_STR("() -> (UInt16 _rv)")},
1975 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
1976 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
1977 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
1978 PyDoc_STR("(LongRect inDestRect) -> None")},
1979 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
1980 PyDoc_STR("(LongRect inViewRect) -> None")},
1981 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
1982 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
1983 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
1984 PyDoc_STR("() -> (SInt32 _rv)")},
1985 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
1986 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1987 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
1988 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
1989 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
1990 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
1991 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
1992 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
1993 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
1994 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
1995 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
1996 PyDoc_STR("() -> (SInt32 _rv)")},
1997 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
1998 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1999 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
2000 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
2001 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
2002 PyDoc_STR("() -> (SInt32 _rv)")},
2003 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
2004 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
2005 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
2006 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2007 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
2008 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
2009 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
2010 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
2011 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
2012 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
2013 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
2014 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
2015 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
2016 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2017 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
2018 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
2019 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
2020 PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
2021 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
2022 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
2023 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
2024 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
2025 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
2026 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
2027 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
2028 PyDoc_STR("() -> (WEAlignment _rv)")},
2029 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
2030 PyDoc_STR("(WEAlignment inAlignment) -> None")},
2031 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
2032 PyDoc_STR("() -> (WEDirection _rv)")},
2033 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
2034 PyDoc_STR("(WEDirection inDirection) -> None")},
2035 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
2036 PyDoc_STR("() -> None")},
2037 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
2038 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
2039 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
2040 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2041 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
2042 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2043 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
2044 PyDoc_STR("() -> None")},
2045 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
2046 PyDoc_STR("() -> None")},
2047 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
2048 PyDoc_STR("() -> None")},
2049 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
2050 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
2051 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
2052 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
2053 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
2054 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
2055 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
2056 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
2057 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
2058 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
2059 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
2060 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
2061 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
2062 PyDoc_STR("() -> None")},
2063 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
2064 PyDoc_STR("(Handle inText) -> None")},
2065 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
2066 PyDoc_STR("(SInt16 inCase) -> None")},
2067 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
2068 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
2069 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
2070 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
2071 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
2072 PyDoc_STR("(StScrpHandle inStyles) -> None")},
2073 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
2074 PyDoc_STR("() -> None")},
2075 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
2076 PyDoc_STR("() -> None")},
2077 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
2078 PyDoc_STR("() -> None")},
2079 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
2080 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
2081 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
2082 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
2083 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
2084 PyDoc_STR("() -> (Boolean _rv)")},
2085 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
2086 PyDoc_STR("() -> None")},
2087 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
2088 PyDoc_STR("(WEActionKind inActionKind) -> None")},
2089 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
2090 PyDoc_STR("() -> (UInt32 _rv)")},
2091 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
2092 PyDoc_STR("() -> None")},
2093 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
2094 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
2095 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
2096 PyDoc_STR("() -> (WEObjectReference outObject)")},
2097 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
2098 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
2099 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
2100 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
2101 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
2102 PyDoc_STR("(WESoupHandle inSoup) -> None")},
2103 {"WECut", (PyCFunction)wasteObj_WECut, 1,
2104 PyDoc_STR("() -> None")},
2105 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
2106 PyDoc_STR("() -> None")},
2107 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
2108 PyDoc_STR("() -> None")},
2109 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
2110 PyDoc_STR("() -> (Boolean _rv)")},
2111 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
2112 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
2113 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
2114 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2115 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
2116 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2117 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
2118 PyDoc_STR("() -> None")},
2119 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
2120 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
2121 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
2122 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
2123 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
2124 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
2125 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
2126 PyDoc_STR("(WESelector inUserTag) -> None")},
2127 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
2128 PyDoc_STR("() -> None")},
2129 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
2130 PyDoc_STR("() -> None")},
2131 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
2132 PyDoc_STR("() -> (Boolean _rv)")},
2133 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
2134 PyDoc_STR("() -> (SInt16 _rv)")},
2135 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
2136 PyDoc_STR("(SInt16 tabWidth) -> None")},
2137 {NULL, NULL, 0}
2140 #define wasteObj_getsetlist NULL
2143 #define wasteObj_compare NULL
2145 #define wasteObj_repr NULL
2147 #define wasteObj_hash NULL
2148 #define wasteObj_tp_init 0
2150 #define wasteObj_tp_alloc PyType_GenericAlloc
2152 static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2154 PyObject *self;
2155 WEReference itself;
2156 char *kw[] = {"itself", 0};
2158 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
2159 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
2160 ((wasteObject *)self)->ob_itself = itself;
2161 return self;
2164 #define wasteObj_tp_free PyObject_Del
2167 PyTypeObject waste_Type = {
2168 PyObject_HEAD_INIT(NULL)
2169 0, /*ob_size*/
2170 "waste.waste", /*tp_name*/
2171 sizeof(wasteObject), /*tp_basicsize*/
2172 0, /*tp_itemsize*/
2173 /* methods */
2174 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2175 0, /*tp_print*/
2176 (getattrfunc)0, /*tp_getattr*/
2177 (setattrfunc)0, /*tp_setattr*/
2178 (cmpfunc) wasteObj_compare, /*tp_compare*/
2179 (reprfunc) wasteObj_repr, /*tp_repr*/
2180 (PyNumberMethods *)0, /* tp_as_number */
2181 (PySequenceMethods *)0, /* tp_as_sequence */
2182 (PyMappingMethods *)0, /* tp_as_mapping */
2183 (hashfunc) wasteObj_hash, /*tp_hash*/
2184 0, /*tp_call*/
2185 0, /*tp_str*/
2186 PyObject_GenericGetAttr, /*tp_getattro*/
2187 PyObject_GenericSetAttr, /*tp_setattro */
2188 0, /*tp_as_buffer*/
2189 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
2190 0, /*tp_doc*/
2191 0, /*tp_traverse*/
2192 0, /*tp_clear*/
2193 0, /*tp_richcompare*/
2194 0, /*tp_weaklistoffset*/
2195 0, /*tp_iter*/
2196 0, /*tp_iternext*/
2197 wasteObj_methods, /* tp_methods */
2198 0, /*tp_members*/
2199 wasteObj_getsetlist, /*tp_getset*/
2200 0, /*tp_base*/
2201 0, /*tp_dict*/
2202 0, /*tp_descr_get*/
2203 0, /*tp_descr_set*/
2204 0, /*tp_dictoffset*/
2205 wasteObj_tp_init, /* tp_init */
2206 wasteObj_tp_alloc, /* tp_alloc */
2207 wasteObj_tp_new, /* tp_new */
2208 wasteObj_tp_free, /* tp_free */
2211 /* --------------------- End object type waste ---------------------- */
2214 static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
2216 PyObject *_res = NULL;
2217 OSErr _err;
2218 LongRect inDestRect;
2219 LongRect inViewRect;
2220 OptionBits inOptions;
2221 WEReference outWE;
2222 if (!PyArg_ParseTuple(_args, "O&O&l",
2223 LongRect_Convert, &inDestRect,
2224 LongRect_Convert, &inViewRect,
2225 &inOptions))
2226 return NULL;
2227 _err = WENew(&inDestRect,
2228 &inViewRect,
2229 inOptions,
2230 &outWE);
2231 if (_err != noErr) return PyMac_Error(_err);
2232 _res = Py_BuildValue("O&",
2233 wasteObj_New, outWE);
2234 return _res;
2237 static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
2239 PyObject *_res = NULL;
2240 OSErr _err;
2241 StScrpHandle ioStyles;
2242 WEFontTableHandle inFontTable;
2243 if (!PyArg_ParseTuple(_args, "O&O&",
2244 ResObj_Convert, &ioStyles,
2245 ResObj_Convert, &inFontTable))
2246 return NULL;
2247 _err = WEUpdateStyleScrap(ioStyles,
2248 inFontTable);
2249 if (_err != noErr) return PyMac_Error(_err);
2250 Py_INCREF(Py_None);
2251 _res = Py_None;
2252 return _res;
2255 static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
2257 PyObject *_res = NULL;
2258 OSErr _err;
2259 if (!PyArg_ParseTuple(_args, ""))
2260 return NULL;
2261 _err = WEInstallTSMHandlers();
2262 if (_err != noErr) return PyMac_Error(_err);
2263 Py_INCREF(Py_None);
2264 _res = Py_None;
2265 return _res;
2268 static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
2270 PyObject *_res = NULL;
2271 OSErr _err;
2272 if (!PyArg_ParseTuple(_args, ""))
2273 return NULL;
2274 _err = WERemoveTSMHandlers();
2275 if (_err != noErr) return PyMac_Error(_err);
2276 Py_INCREF(Py_None);
2277 _res = Py_None;
2278 return _res;
2281 static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
2283 PyObject *_res = NULL;
2284 OSErr _err;
2285 AppleEvent inAppleEvent;
2286 AppleEvent ioReply;
2287 if (!PyArg_ParseTuple(_args, "O&",
2288 AEDesc_Convert, &inAppleEvent))
2289 return NULL;
2290 _err = WEHandleTSMEvent(&inAppleEvent,
2291 &ioReply);
2292 if (_err != noErr) return PyMac_Error(_err);
2293 _res = Py_BuildValue("O&",
2294 AEDesc_New, &ioReply);
2295 return _res;
2298 static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
2300 PyObject *_res = NULL;
2301 LongPt inLongPoint;
2302 Point outPoint;
2303 if (!PyArg_ParseTuple(_args, "O&",
2304 LongPt_Convert, &inLongPoint))
2305 return NULL;
2306 WELongPointToPoint(&inLongPoint,
2307 &outPoint);
2308 _res = Py_BuildValue("O&",
2309 PyMac_BuildPoint, outPoint);
2310 return _res;
2313 static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
2315 PyObject *_res = NULL;
2316 Point inPoint;
2317 LongPt outLongPoint;
2318 if (!PyArg_ParseTuple(_args, "O&",
2319 PyMac_GetPoint, &inPoint))
2320 return NULL;
2321 WEPointToLongPoint(inPoint,
2322 &outLongPoint);
2323 _res = Py_BuildValue("O&",
2324 LongPt_New, &outLongPoint);
2325 return _res;
2328 static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
2330 PyObject *_res = NULL;
2331 LongRect outLongRect;
2332 SInt32 inLeft;
2333 SInt32 inTop;
2334 SInt32 inRight;
2335 SInt32 inBottom;
2336 if (!PyArg_ParseTuple(_args, "llll",
2337 &inLeft,
2338 &inTop,
2339 &inRight,
2340 &inBottom))
2341 return NULL;
2342 WESetLongRect(&outLongRect,
2343 inLeft,
2344 inTop,
2345 inRight,
2346 inBottom);
2347 _res = Py_BuildValue("O&",
2348 LongRect_New, &outLongRect);
2349 return _res;
2352 static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
2354 PyObject *_res = NULL;
2355 LongRect inLongRect;
2356 Rect outRect;
2357 if (!PyArg_ParseTuple(_args, "O&",
2358 LongRect_Convert, &inLongRect))
2359 return NULL;
2360 WELongRectToRect(&inLongRect,
2361 &outRect);
2362 _res = Py_BuildValue("O&",
2363 PyMac_BuildRect, &outRect);
2364 return _res;
2367 static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
2369 PyObject *_res = NULL;
2370 Rect inRect;
2371 LongRect outLongRect;
2372 if (!PyArg_ParseTuple(_args, "O&",
2373 PyMac_GetRect, &inRect))
2374 return NULL;
2375 WERectToLongRect(&inRect,
2376 &outLongRect);
2377 _res = Py_BuildValue("O&",
2378 LongRect_New, &outLongRect);
2379 return _res;
2382 static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
2384 PyObject *_res = NULL;
2385 LongRect ioLongRect;
2386 SInt32 inHorizontalOffset;
2387 SInt32 inVerticalOffset;
2388 if (!PyArg_ParseTuple(_args, "ll",
2389 &inHorizontalOffset,
2390 &inVerticalOffset))
2391 return NULL;
2392 WEOffsetLongRect(&ioLongRect,
2393 inHorizontalOffset,
2394 inVerticalOffset);
2395 _res = Py_BuildValue("O&",
2396 LongRect_New, &ioLongRect);
2397 return _res;
2400 static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
2402 PyObject *_res = NULL;
2403 Boolean _rv;
2404 LongPt inLongPoint;
2405 LongRect inLongRect;
2406 if (!PyArg_ParseTuple(_args, "O&O&",
2407 LongPt_Convert, &inLongPoint,
2408 LongRect_Convert, &inLongRect))
2409 return NULL;
2410 _rv = WELongPointInLongRect(&inLongPoint,
2411 &inLongRect);
2412 _res = Py_BuildValue("b",
2413 _rv);
2414 return _res;
2417 static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
2419 PyObject *_res = NULL;
2421 OSErr err;
2422 // install the sample object handlers for pictures and sounds
2423 #define kTypePicture 'PICT'
2424 #define kTypeSound 'snd '
2426 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2428 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2429 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2430 goto cleanup;
2432 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2433 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2434 goto cleanup;
2436 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2437 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2438 goto cleanup;
2440 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2441 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2442 goto cleanup;
2444 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2445 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2446 goto cleanup;
2448 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2449 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2450 goto cleanup;
2451 Py_INCREF(Py_None);
2452 _res = Py_None;
2453 return _res;
2455 cleanup:
2456 return PyMac_Error(err);
2460 static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
2462 PyObject *_res = NULL;
2464 OSErr err;
2465 FlavorType objectType;
2466 WESelector selector;
2467 PyObject *py_handler;
2468 UniversalProcPtr handler;
2469 WEReference we = NULL;
2470 PyObject *key;
2473 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2474 PyMac_GetOSType, &objectType,
2475 PyMac_GetOSType, &selector,
2476 &py_handler,
2477 WEOObj_Convert, &we) ) return NULL;
2479 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2480 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2481 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2482 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
2483 else return PyMac_Error(weUndefinedSelectorErr);
2485 if ((key = Py_BuildValue("O&O&",
2486 PyMac_BuildOSType, objectType,
2487 PyMac_BuildOSType, selector)) == NULL )
2488 return NULL;
2490 PyDict_SetItem(callbackdict, key, py_handler);
2492 err = WEInstallObjectHandler(objectType, selector, handler, we);
2493 if ( err ) return PyMac_Error(err);
2494 Py_INCREF(Py_None);
2495 _res = Py_None;
2496 return _res;
2500 static PyMethodDef waste_methods[] = {
2501 {"WENew", (PyCFunction)waste_WENew, 1,
2502 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
2503 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
2504 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
2505 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
2506 PyDoc_STR("() -> None")},
2507 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
2508 PyDoc_STR("() -> None")},
2509 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
2510 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
2511 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
2512 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
2513 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
2514 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
2515 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
2516 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
2517 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
2518 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
2519 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
2520 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
2521 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
2522 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
2523 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
2524 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
2525 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
2526 PyDoc_STR(NULL)},
2527 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
2528 PyDoc_STR(NULL)},
2529 {NULL, NULL, 0}
2534 /* Return the object corresponding to the window, or NULL */
2536 PyObject *
2537 ExistingwasteObj_New(w)
2538 WEReference w;
2540 PyObject *it = NULL;
2542 if (w == NULL)
2543 it = NULL;
2544 else
2545 WEGetInfo(weRefCon, (void *)&it, w);
2546 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2547 it = Py_None;
2548 Py_INCREF(it);
2549 return it;
2553 void initwaste(void)
2555 PyObject *m;
2556 PyObject *d;
2561 m = Py_InitModule("waste", waste_methods);
2562 d = PyModule_GetDict(m);
2563 waste_Error = PyMac_GetOSErrException();
2564 if (waste_Error == NULL ||
2565 PyDict_SetItemString(d, "Error", waste_Error) != 0)
2566 return;
2567 WEO_Type.ob_type = &PyType_Type;
2568 if (PyType_Ready(&WEO_Type) < 0) return;
2569 Py_INCREF(&WEO_Type);
2570 PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
2571 /* Backward-compatible name */
2572 Py_INCREF(&WEO_Type);
2573 PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
2574 waste_Type.ob_type = &PyType_Type;
2575 if (PyType_Ready(&waste_Type) < 0) return;
2576 Py_INCREF(&waste_Type);
2577 PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
2578 /* Backward-compatible name */
2579 Py_INCREF(&waste_Type);
2580 PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
2582 callbackdict = PyDict_New();
2583 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
2584 return;
2585 upp_new_handler = NewWENewObjectProc(my_new_handler);
2586 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2587 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2588 upp_click_handler = NewWEClickObjectProc(my_click_handler);
2593 /* ======================== End module waste ======================== */