PageRenderTime 986ms CodeModel.GetById 221ms app.highlight 466ms RepoModel.GetById 289ms app.codeStats 0ms

/Mac/Modules/te/_TEmodule.c

http://unladen-swallow.googlecode.com/
C | 1339 lines | 1198 code | 131 blank | 10 comment | 73 complexity | ceff86830da476b7ece1783c503f48e5 MD5 | raw file
   1
   2/* =========================== Module _TE =========================== */
   3
   4#include "Python.h"
   5
   6#ifndef __LP64__
   7
   8
   9#include "pymactoolbox.h"
  10
  11/* Macro to test whether a weak-loaded CFM function exists */
  12#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
  13        PyErr_SetString(PyExc_NotImplementedError, \
  14        "Not available in this shared library/OS version"); \
  15        return NULL; \
  16    }} while(0)
  17
  18
  19#include <Carbon/Carbon.h>
  20
  21#ifdef USE_TOOLBOX_OBJECT_GLUE
  22extern PyObject *_TEObj_New(TEHandle);
  23extern int _TEObj_Convert(PyObject *, TEHandle *);
  24
  25#define TEObj_New _TEObj_New
  26#define TEObj_Convert _TEObj_Convert
  27#endif
  28
  29#define as_TE(h) ((TEHandle)h)
  30#define as_Resource(teh) ((Handle)teh)
  31
  32/*
  33** Parse/generate TextStyle records
  34*/
  35static PyObject *
  36TextStyle_New(TextStylePtr itself)
  37{
  38
  39        return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
  40                                &itself->tsColor);
  41}
  42
  43static int
  44TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
  45{
  46        long font, face, size;
  47
  48        if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
  49                return 0;
  50        p_itself->tsFont = (short)font;
  51        p_itself->tsFace = (Style)face;
  52        p_itself->tsSize = (short)size;
  53        return 1;
  54}
  55
  56static PyObject *TE_Error;
  57
  58/* ------------------------- Object type TE ------------------------- */
  59
  60PyTypeObject TE_Type;
  61
  62#define TEObj_Check(x) ((x)->ob_type == &TE_Type || PyObject_TypeCheck((x), &TE_Type))
  63
  64typedef struct TEObject {
  65	PyObject_HEAD
  66	TEHandle ob_itself;
  67} TEObject;
  68
  69PyObject *TEObj_New(TEHandle itself)
  70{
  71	TEObject *it;
  72	if (itself == NULL) {
  73	                                PyErr_SetString(TE_Error,"Cannot create null TE");
  74	                                return NULL;
  75	                        }
  76	it = PyObject_NEW(TEObject, &TE_Type);
  77	if (it == NULL) return NULL;
  78	it->ob_itself = itself;
  79	return (PyObject *)it;
  80}
  81
  82int TEObj_Convert(PyObject *v, TEHandle *p_itself)
  83{
  84	if (!TEObj_Check(v))
  85	{
  86		PyErr_SetString(PyExc_TypeError, "TE required");
  87		return 0;
  88	}
  89	*p_itself = ((TEObject *)v)->ob_itself;
  90	return 1;
  91}
  92
  93static void TEObj_dealloc(TEObject *self)
  94{
  95	TEDispose(self->ob_itself);
  96	self->ob_type->tp_free((PyObject *)self);
  97}
  98
  99static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args)
 100{
 101	PyObject *_res = NULL;
 102	char *text__in__;
 103	long text__len__;
 104	int text__in_len__;
 105#ifndef TESetText
 106	PyMac_PRECHECK(TESetText);
 107#endif
 108	if (!PyArg_ParseTuple(_args, "s#",
 109	                      &text__in__, &text__in_len__))
 110		return NULL;
 111	text__len__ = text__in_len__;
 112	TESetText(text__in__, text__len__,
 113	          _self->ob_itself);
 114	Py_INCREF(Py_None);
 115	_res = Py_None;
 116	return _res;
 117}
 118
 119static PyObject *TEObj_TEGetText(TEObject *_self, PyObject *_args)
 120{
 121	PyObject *_res = NULL;
 122	CharsHandle _rv;
 123#ifndef TEGetText
 124	PyMac_PRECHECK(TEGetText);
 125#endif
 126	if (!PyArg_ParseTuple(_args, ""))
 127		return NULL;
 128	_rv = TEGetText(_self->ob_itself);
 129	_res = Py_BuildValue("O&",
 130	                     ResObj_New, _rv);
 131	return _res;
 132}
 133
 134static PyObject *TEObj_TEIdle(TEObject *_self, PyObject *_args)
 135{
 136	PyObject *_res = NULL;
 137#ifndef TEIdle
 138	PyMac_PRECHECK(TEIdle);
 139#endif
 140	if (!PyArg_ParseTuple(_args, ""))
 141		return NULL;
 142	TEIdle(_self->ob_itself);
 143	Py_INCREF(Py_None);
 144	_res = Py_None;
 145	return _res;
 146}
 147
 148static PyObject *TEObj_TESetSelect(TEObject *_self, PyObject *_args)
 149{
 150	PyObject *_res = NULL;
 151	long selStart;
 152	long selEnd;
 153#ifndef TESetSelect
 154	PyMac_PRECHECK(TESetSelect);
 155#endif
 156	if (!PyArg_ParseTuple(_args, "ll",
 157	                      &selStart,
 158	                      &selEnd))
 159		return NULL;
 160	TESetSelect(selStart,
 161	            selEnd,
 162	            _self->ob_itself);
 163	Py_INCREF(Py_None);
 164	_res = Py_None;
 165	return _res;
 166}
 167
 168static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args)
 169{
 170	PyObject *_res = NULL;
 171#ifndef TEActivate
 172	PyMac_PRECHECK(TEActivate);
 173#endif
 174	if (!PyArg_ParseTuple(_args, ""))
 175		return NULL;
 176	TEActivate(_self->ob_itself);
 177	Py_INCREF(Py_None);
 178	_res = Py_None;
 179	return _res;
 180}
 181
 182static PyObject *TEObj_TEDeactivate(TEObject *_self, PyObject *_args)
 183{
 184	PyObject *_res = NULL;
 185#ifndef TEDeactivate
 186	PyMac_PRECHECK(TEDeactivate);
 187#endif
 188	if (!PyArg_ParseTuple(_args, ""))
 189		return NULL;
 190	TEDeactivate(_self->ob_itself);
 191	Py_INCREF(Py_None);
 192	_res = Py_None;
 193	return _res;
 194}
 195
 196static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args)
 197{
 198	PyObject *_res = NULL;
 199	CharParameter key;
 200#ifndef TEKey
 201	PyMac_PRECHECK(TEKey);
 202#endif
 203	if (!PyArg_ParseTuple(_args, "h",
 204	                      &key))
 205		return NULL;
 206	TEKey(key,
 207	      _self->ob_itself);
 208	Py_INCREF(Py_None);
 209	_res = Py_None;
 210	return _res;
 211}
 212
 213static PyObject *TEObj_TECut(TEObject *_self, PyObject *_args)
 214{
 215	PyObject *_res = NULL;
 216#ifndef TECut
 217	PyMac_PRECHECK(TECut);
 218#endif
 219	if (!PyArg_ParseTuple(_args, ""))
 220		return NULL;
 221	TECut(_self->ob_itself);
 222	Py_INCREF(Py_None);
 223	_res = Py_None;
 224	return _res;
 225}
 226
 227static PyObject *TEObj_TECopy(TEObject *_self, PyObject *_args)
 228{
 229	PyObject *_res = NULL;
 230#ifndef TECopy
 231	PyMac_PRECHECK(TECopy);
 232#endif
 233	if (!PyArg_ParseTuple(_args, ""))
 234		return NULL;
 235	TECopy(_self->ob_itself);
 236	Py_INCREF(Py_None);
 237	_res = Py_None;
 238	return _res;
 239}
 240
 241static PyObject *TEObj_TEPaste(TEObject *_self, PyObject *_args)
 242{
 243	PyObject *_res = NULL;
 244#ifndef TEPaste
 245	PyMac_PRECHECK(TEPaste);
 246#endif
 247	if (!PyArg_ParseTuple(_args, ""))
 248		return NULL;
 249	TEPaste(_self->ob_itself);
 250	Py_INCREF(Py_None);
 251	_res = Py_None;
 252	return _res;
 253}
 254
 255static PyObject *TEObj_TEDelete(TEObject *_self, PyObject *_args)
 256{
 257	PyObject *_res = NULL;
 258#ifndef TEDelete
 259	PyMac_PRECHECK(TEDelete);
 260#endif
 261	if (!PyArg_ParseTuple(_args, ""))
 262		return NULL;
 263	TEDelete(_self->ob_itself);
 264	Py_INCREF(Py_None);
 265	_res = Py_None;
 266	return _res;
 267}
 268
 269static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args)
 270{
 271	PyObject *_res = NULL;
 272	char *text__in__;
 273	long text__len__;
 274	int text__in_len__;
 275#ifndef TEInsert
 276	PyMac_PRECHECK(TEInsert);
 277#endif
 278	if (!PyArg_ParseTuple(_args, "s#",
 279	                      &text__in__, &text__in_len__))
 280		return NULL;
 281	text__len__ = text__in_len__;
 282	TEInsert(text__in__, text__len__,
 283	         _self->ob_itself);
 284	Py_INCREF(Py_None);
 285	_res = Py_None;
 286	return _res;
 287}
 288
 289static PyObject *TEObj_TESetAlignment(TEObject *_self, PyObject *_args)
 290{
 291	PyObject *_res = NULL;
 292	short just;
 293#ifndef TESetAlignment
 294	PyMac_PRECHECK(TESetAlignment);
 295#endif
 296	if (!PyArg_ParseTuple(_args, "h",
 297	                      &just))
 298		return NULL;
 299	TESetAlignment(just,
 300	               _self->ob_itself);
 301	Py_INCREF(Py_None);
 302	_res = Py_None;
 303	return _res;
 304}
 305
 306static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args)
 307{
 308	PyObject *_res = NULL;
 309	Rect rUpdate;
 310#ifndef TEUpdate
 311	PyMac_PRECHECK(TEUpdate);
 312#endif
 313	if (!PyArg_ParseTuple(_args, "O&",
 314	                      PyMac_GetRect, &rUpdate))
 315		return NULL;
 316	TEUpdate(&rUpdate,
 317	         _self->ob_itself);
 318	Py_INCREF(Py_None);
 319	_res = Py_None;
 320	return _res;
 321}
 322
 323static PyObject *TEObj_TEScroll(TEObject *_self, PyObject *_args)
 324{
 325	PyObject *_res = NULL;
 326	short dh;
 327	short dv;
 328#ifndef TEScroll
 329	PyMac_PRECHECK(TEScroll);
 330#endif
 331	if (!PyArg_ParseTuple(_args, "hh",
 332	                      &dh,
 333	                      &dv))
 334		return NULL;
 335	TEScroll(dh,
 336	         dv,
 337	         _self->ob_itself);
 338	Py_INCREF(Py_None);
 339	_res = Py_None;
 340	return _res;
 341}
 342
 343static PyObject *TEObj_TESelView(TEObject *_self, PyObject *_args)
 344{
 345	PyObject *_res = NULL;
 346#ifndef TESelView
 347	PyMac_PRECHECK(TESelView);
 348#endif
 349	if (!PyArg_ParseTuple(_args, ""))
 350		return NULL;
 351	TESelView(_self->ob_itself);
 352	Py_INCREF(Py_None);
 353	_res = Py_None;
 354	return _res;
 355}
 356
 357static PyObject *TEObj_TEPinScroll(TEObject *_self, PyObject *_args)
 358{
 359	PyObject *_res = NULL;
 360	short dh;
 361	short dv;
 362#ifndef TEPinScroll
 363	PyMac_PRECHECK(TEPinScroll);
 364#endif
 365	if (!PyArg_ParseTuple(_args, "hh",
 366	                      &dh,
 367	                      &dv))
 368		return NULL;
 369	TEPinScroll(dh,
 370	            dv,
 371	            _self->ob_itself);
 372	Py_INCREF(Py_None);
 373	_res = Py_None;
 374	return _res;
 375}
 376
 377static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args)
 378{
 379	PyObject *_res = NULL;
 380	Boolean fAuto;
 381#ifndef TEAutoView
 382	PyMac_PRECHECK(TEAutoView);
 383#endif
 384	if (!PyArg_ParseTuple(_args, "b",
 385	                      &fAuto))
 386		return NULL;
 387	TEAutoView(fAuto,
 388	           _self->ob_itself);
 389	Py_INCREF(Py_None);
 390	_res = Py_None;
 391	return _res;
 392}
 393
 394static PyObject *TEObj_TECalText(TEObject *_self, PyObject *_args)
 395{
 396	PyObject *_res = NULL;
 397#ifndef TECalText
 398	PyMac_PRECHECK(TECalText);
 399#endif
 400	if (!PyArg_ParseTuple(_args, ""))
 401		return NULL;
 402	TECalText(_self->ob_itself);
 403	Py_INCREF(Py_None);
 404	_res = Py_None;
 405	return _res;
 406}
 407
 408static PyObject *TEObj_TEGetOffset(TEObject *_self, PyObject *_args)
 409{
 410	PyObject *_res = NULL;
 411	short _rv;
 412	Point pt;
 413#ifndef TEGetOffset
 414	PyMac_PRECHECK(TEGetOffset);
 415#endif
 416	if (!PyArg_ParseTuple(_args, "O&",
 417	                      PyMac_GetPoint, &pt))
 418		return NULL;
 419	_rv = TEGetOffset(pt,
 420	                  _self->ob_itself);
 421	_res = Py_BuildValue("h",
 422	                     _rv);
 423	return _res;
 424}
 425
 426static PyObject *TEObj_TEGetPoint(TEObject *_self, PyObject *_args)
 427{
 428	PyObject *_res = NULL;
 429	Point _rv;
 430	short offset;
 431#ifndef TEGetPoint
 432	PyMac_PRECHECK(TEGetPoint);
 433#endif
 434	if (!PyArg_ParseTuple(_args, "h",
 435	                      &offset))
 436		return NULL;
 437	_rv = TEGetPoint(offset,
 438	                 _self->ob_itself);
 439	_res = Py_BuildValue("O&",
 440	                     PyMac_BuildPoint, _rv);
 441	return _res;
 442}
 443
 444static PyObject *TEObj_TEClick(TEObject *_self, PyObject *_args)
 445{
 446	PyObject *_res = NULL;
 447	Point pt;
 448	Boolean fExtend;
 449#ifndef TEClick
 450	PyMac_PRECHECK(TEClick);
 451#endif
 452	if (!PyArg_ParseTuple(_args, "O&b",
 453	                      PyMac_GetPoint, &pt,
 454	                      &fExtend))
 455		return NULL;
 456	TEClick(pt,
 457	        fExtend,
 458	        _self->ob_itself);
 459	Py_INCREF(Py_None);
 460	_res = Py_None;
 461	return _res;
 462}
 463
 464static PyObject *TEObj_TESetStyleHandle(TEObject *_self, PyObject *_args)
 465{
 466	PyObject *_res = NULL;
 467	TEStyleHandle theHandle;
 468#ifndef TESetStyleHandle
 469	PyMac_PRECHECK(TESetStyleHandle);
 470#endif
 471	if (!PyArg_ParseTuple(_args, "O&",
 472	                      ResObj_Convert, &theHandle))
 473		return NULL;
 474	TESetStyleHandle(theHandle,
 475	                 _self->ob_itself);
 476	Py_INCREF(Py_None);
 477	_res = Py_None;
 478	return _res;
 479}
 480
 481static PyObject *TEObj_TEGetStyleHandle(TEObject *_self, PyObject *_args)
 482{
 483	PyObject *_res = NULL;
 484	TEStyleHandle _rv;
 485#ifndef TEGetStyleHandle
 486	PyMac_PRECHECK(TEGetStyleHandle);
 487#endif
 488	if (!PyArg_ParseTuple(_args, ""))
 489		return NULL;
 490	_rv = TEGetStyleHandle(_self->ob_itself);
 491	_res = Py_BuildValue("O&",
 492	                     ResObj_New, _rv);
 493	return _res;
 494}
 495
 496static PyObject *TEObj_TEGetStyle(TEObject *_self, PyObject *_args)
 497{
 498	PyObject *_res = NULL;
 499	short offset;
 500	TextStyle theStyle;
 501	short lineHeight;
 502	short fontAscent;
 503#ifndef TEGetStyle
 504	PyMac_PRECHECK(TEGetStyle);
 505#endif
 506	if (!PyArg_ParseTuple(_args, "h",
 507	                      &offset))
 508		return NULL;
 509	TEGetStyle(offset,
 510	           &theStyle,
 511	           &lineHeight,
 512	           &fontAscent,
 513	           _self->ob_itself);
 514	_res = Py_BuildValue("O&hh",
 515	                     TextStyle_New, &theStyle,
 516	                     lineHeight,
 517	                     fontAscent);
 518	return _res;
 519}
 520
 521static PyObject *TEObj_TEStylePaste(TEObject *_self, PyObject *_args)
 522{
 523	PyObject *_res = NULL;
 524#ifndef TEStylePaste
 525	PyMac_PRECHECK(TEStylePaste);
 526#endif
 527	if (!PyArg_ParseTuple(_args, ""))
 528		return NULL;
 529	TEStylePaste(_self->ob_itself);
 530	Py_INCREF(Py_None);
 531	_res = Py_None;
 532	return _res;
 533}
 534
 535static PyObject *TEObj_TESetStyle(TEObject *_self, PyObject *_args)
 536{
 537	PyObject *_res = NULL;
 538	short mode;
 539	TextStyle newStyle;
 540	Boolean fRedraw;
 541#ifndef TESetStyle
 542	PyMac_PRECHECK(TESetStyle);
 543#endif
 544	if (!PyArg_ParseTuple(_args, "hO&b",
 545	                      &mode,
 546	                      TextStyle_Convert, &newStyle,
 547	                      &fRedraw))
 548		return NULL;
 549	TESetStyle(mode,
 550	           &newStyle,
 551	           fRedraw,
 552	           _self->ob_itself);
 553	Py_INCREF(Py_None);
 554	_res = Py_None;
 555	return _res;
 556}
 557
 558static PyObject *TEObj_TEReplaceStyle(TEObject *_self, PyObject *_args)
 559{
 560	PyObject *_res = NULL;
 561	short mode;
 562	TextStyle oldStyle;
 563	TextStyle newStyle;
 564	Boolean fRedraw;
 565#ifndef TEReplaceStyle
 566	PyMac_PRECHECK(TEReplaceStyle);
 567#endif
 568	if (!PyArg_ParseTuple(_args, "hO&O&b",
 569	                      &mode,
 570	                      TextStyle_Convert, &oldStyle,
 571	                      TextStyle_Convert, &newStyle,
 572	                      &fRedraw))
 573		return NULL;
 574	TEReplaceStyle(mode,
 575	               &oldStyle,
 576	               &newStyle,
 577	               fRedraw,
 578	               _self->ob_itself);
 579	Py_INCREF(Py_None);
 580	_res = Py_None;
 581	return _res;
 582}
 583
 584static PyObject *TEObj_TEGetStyleScrapHandle(TEObject *_self, PyObject *_args)
 585{
 586	PyObject *_res = NULL;
 587	StScrpHandle _rv;
 588#ifndef TEGetStyleScrapHandle
 589	PyMac_PRECHECK(TEGetStyleScrapHandle);
 590#endif
 591	if (!PyArg_ParseTuple(_args, ""))
 592		return NULL;
 593	_rv = TEGetStyleScrapHandle(_self->ob_itself);
 594	_res = Py_BuildValue("O&",
 595	                     ResObj_New, _rv);
 596	return _res;
 597}
 598
 599static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args)
 600{
 601	PyObject *_res = NULL;
 602	char *text__in__;
 603	long text__len__;
 604	int text__in_len__;
 605	StScrpHandle hST;
 606#ifndef TEStyleInsert
 607	PyMac_PRECHECK(TEStyleInsert);
 608#endif
 609	if (!PyArg_ParseTuple(_args, "s#O&",
 610	                      &text__in__, &text__in_len__,
 611	                      ResObj_Convert, &hST))
 612		return NULL;
 613	text__len__ = text__in_len__;
 614	TEStyleInsert(text__in__, text__len__,
 615	              hST,
 616	              _self->ob_itself);
 617	Py_INCREF(Py_None);
 618	_res = Py_None;
 619	return _res;
 620}
 621
 622static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args)
 623{
 624	PyObject *_res = NULL;
 625	long _rv;
 626	long endLine;
 627	long startLine;
 628#ifndef TEGetHeight
 629	PyMac_PRECHECK(TEGetHeight);
 630#endif
 631	if (!PyArg_ParseTuple(_args, "ll",
 632	                      &endLine,
 633	                      &startLine))
 634		return NULL;
 635	_rv = TEGetHeight(endLine,
 636	                  startLine,
 637	                  _self->ob_itself);
 638	_res = Py_BuildValue("l",
 639	                     _rv);
 640	return _res;
 641}
 642
 643static PyObject *TEObj_TEContinuousStyle(TEObject *_self, PyObject *_args)
 644{
 645	PyObject *_res = NULL;
 646	Boolean _rv;
 647	short mode;
 648	TextStyle aStyle;
 649#ifndef TEContinuousStyle
 650	PyMac_PRECHECK(TEContinuousStyle);
 651#endif
 652	if (!PyArg_ParseTuple(_args, "hO&",
 653	                      &mode,
 654	                      TextStyle_Convert, &aStyle))
 655		return NULL;
 656	_rv = TEContinuousStyle(&mode,
 657	                        &aStyle,
 658	                        _self->ob_itself);
 659	_res = Py_BuildValue("bhO&",
 660	                     _rv,
 661	                     mode,
 662	                     TextStyle_New, &aStyle);
 663	return _res;
 664}
 665
 666static PyObject *TEObj_TEUseStyleScrap(TEObject *_self, PyObject *_args)
 667{
 668	PyObject *_res = NULL;
 669	long rangeStart;
 670	long rangeEnd;
 671	StScrpHandle newStyles;
 672	Boolean fRedraw;
 673#ifndef TEUseStyleScrap
 674	PyMac_PRECHECK(TEUseStyleScrap);
 675#endif
 676	if (!PyArg_ParseTuple(_args, "llO&b",
 677	                      &rangeStart,
 678	                      &rangeEnd,
 679	                      ResObj_Convert, &newStyles,
 680	                      &fRedraw))
 681		return NULL;
 682	TEUseStyleScrap(rangeStart,
 683	                rangeEnd,
 684	                newStyles,
 685	                fRedraw,
 686	                _self->ob_itself);
 687	Py_INCREF(Py_None);
 688	_res = Py_None;
 689	return _res;
 690}
 691
 692static PyObject *TEObj_TENumStyles(TEObject *_self, PyObject *_args)
 693{
 694	PyObject *_res = NULL;
 695	long _rv;
 696	long rangeStart;
 697	long rangeEnd;
 698#ifndef TENumStyles
 699	PyMac_PRECHECK(TENumStyles);
 700#endif
 701	if (!PyArg_ParseTuple(_args, "ll",
 702	                      &rangeStart,
 703	                      &rangeEnd))
 704		return NULL;
 705	_rv = TENumStyles(rangeStart,
 706	                  rangeEnd,
 707	                  _self->ob_itself);
 708	_res = Py_BuildValue("l",
 709	                     _rv);
 710	return _res;
 711}
 712
 713static PyObject *TEObj_TEFeatureFlag(TEObject *_self, PyObject *_args)
 714{
 715	PyObject *_res = NULL;
 716	short _rv;
 717	short feature;
 718	short action;
 719#ifndef TEFeatureFlag
 720	PyMac_PRECHECK(TEFeatureFlag);
 721#endif
 722	if (!PyArg_ParseTuple(_args, "hh",
 723	                      &feature,
 724	                      &action))
 725		return NULL;
 726	_rv = TEFeatureFlag(feature,
 727	                    action,
 728	                    _self->ob_itself);
 729	_res = Py_BuildValue("h",
 730	                     _rv);
 731	return _res;
 732}
 733
 734static PyObject *TEObj_TEGetHiliteRgn(TEObject *_self, PyObject *_args)
 735{
 736	PyObject *_res = NULL;
 737	OSErr _err;
 738	RgnHandle region;
 739#ifndef TEGetHiliteRgn
 740	PyMac_PRECHECK(TEGetHiliteRgn);
 741#endif
 742	if (!PyArg_ParseTuple(_args, "O&",
 743	                      ResObj_Convert, &region))
 744		return NULL;
 745	_err = TEGetHiliteRgn(region,
 746	                      _self->ob_itself);
 747	if (_err != noErr) return PyMac_Error(_err);
 748	Py_INCREF(Py_None);
 749	_res = Py_None;
 750	return _res;
 751}
 752
 753static PyObject *TEObj_as_Resource(TEObject *_self, PyObject *_args)
 754{
 755	PyObject *_res = NULL;
 756	Handle _rv;
 757#ifndef as_Resource
 758	PyMac_PRECHECK(as_Resource);
 759#endif
 760	if (!PyArg_ParseTuple(_args, ""))
 761		return NULL;
 762	_rv = as_Resource(_self->ob_itself);
 763	_res = Py_BuildValue("O&",
 764	                     ResObj_New, _rv);
 765	return _res;
 766}
 767
 768static PyMethodDef TEObj_methods[] = {
 769	{"TESetText", (PyCFunction)TEObj_TESetText, 1,
 770	 PyDoc_STR("(Buffer text) -> None")},
 771	{"TEGetText", (PyCFunction)TEObj_TEGetText, 1,
 772	 PyDoc_STR("() -> (CharsHandle _rv)")},
 773	{"TEIdle", (PyCFunction)TEObj_TEIdle, 1,
 774	 PyDoc_STR("() -> None")},
 775	{"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1,
 776	 PyDoc_STR("(long selStart, long selEnd) -> None")},
 777	{"TEActivate", (PyCFunction)TEObj_TEActivate, 1,
 778	 PyDoc_STR("() -> None")},
 779	{"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1,
 780	 PyDoc_STR("() -> None")},
 781	{"TEKey", (PyCFunction)TEObj_TEKey, 1,
 782	 PyDoc_STR("(CharParameter key) -> None")},
 783	{"TECut", (PyCFunction)TEObj_TECut, 1,
 784	 PyDoc_STR("() -> None")},
 785	{"TECopy", (PyCFunction)TEObj_TECopy, 1,
 786	 PyDoc_STR("() -> None")},
 787	{"TEPaste", (PyCFunction)TEObj_TEPaste, 1,
 788	 PyDoc_STR("() -> None")},
 789	{"TEDelete", (PyCFunction)TEObj_TEDelete, 1,
 790	 PyDoc_STR("() -> None")},
 791	{"TEInsert", (PyCFunction)TEObj_TEInsert, 1,
 792	 PyDoc_STR("(Buffer text) -> None")},
 793	{"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1,
 794	 PyDoc_STR("(short just) -> None")},
 795	{"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1,
 796	 PyDoc_STR("(Rect rUpdate) -> None")},
 797	{"TEScroll", (PyCFunction)TEObj_TEScroll, 1,
 798	 PyDoc_STR("(short dh, short dv) -> None")},
 799	{"TESelView", (PyCFunction)TEObj_TESelView, 1,
 800	 PyDoc_STR("() -> None")},
 801	{"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1,
 802	 PyDoc_STR("(short dh, short dv) -> None")},
 803	{"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1,
 804	 PyDoc_STR("(Boolean fAuto) -> None")},
 805	{"TECalText", (PyCFunction)TEObj_TECalText, 1,
 806	 PyDoc_STR("() -> None")},
 807	{"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1,
 808	 PyDoc_STR("(Point pt) -> (short _rv)")},
 809	{"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1,
 810	 PyDoc_STR("(short offset) -> (Point _rv)")},
 811	{"TEClick", (PyCFunction)TEObj_TEClick, 1,
 812	 PyDoc_STR("(Point pt, Boolean fExtend) -> None")},
 813	{"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1,
 814	 PyDoc_STR("(TEStyleHandle theHandle) -> None")},
 815	{"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1,
 816	 PyDoc_STR("() -> (TEStyleHandle _rv)")},
 817	{"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1,
 818	 PyDoc_STR("(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)")},
 819	{"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1,
 820	 PyDoc_STR("() -> None")},
 821	{"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1,
 822	 PyDoc_STR("(short mode, TextStyle newStyle, Boolean fRedraw) -> None")},
 823	{"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1,
 824	 PyDoc_STR("(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None")},
 825	{"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1,
 826	 PyDoc_STR("() -> (StScrpHandle _rv)")},
 827	{"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1,
 828	 PyDoc_STR("(Buffer text, StScrpHandle hST) -> None")},
 829	{"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1,
 830	 PyDoc_STR("(long endLine, long startLine) -> (long _rv)")},
 831	{"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1,
 832	 PyDoc_STR("(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)")},
 833	{"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1,
 834	 PyDoc_STR("(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None")},
 835	{"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1,
 836	 PyDoc_STR("(long rangeStart, long rangeEnd) -> (long _rv)")},
 837	{"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1,
 838	 PyDoc_STR("(short feature, short action) -> (short _rv)")},
 839	{"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1,
 840	 PyDoc_STR("(RgnHandle region) -> None")},
 841	{"as_Resource", (PyCFunction)TEObj_as_Resource, 1,
 842	 PyDoc_STR("() -> (Handle _rv)")},
 843	{NULL, NULL, 0}
 844};
 845
 846static PyObject *TEObj_get_destRect(TEObject *self, void *closure)
 847{
 848	return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);
 849}
 850
 851#define TEObj_set_destRect NULL
 852
 853static PyObject *TEObj_get_viewRect(TEObject *self, void *closure)
 854{
 855	return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);
 856}
 857
 858#define TEObj_set_viewRect NULL
 859
 860static PyObject *TEObj_get_selRect(TEObject *self, void *closure)
 861{
 862	return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);
 863}
 864
 865#define TEObj_set_selRect NULL
 866
 867static PyObject *TEObj_get_lineHeight(TEObject *self, void *closure)
 868{
 869	return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
 870}
 871
 872#define TEObj_set_lineHeight NULL
 873
 874static PyObject *TEObj_get_fontAscent(TEObject *self, void *closure)
 875{
 876	return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
 877}
 878
 879#define TEObj_set_fontAscent NULL
 880
 881static PyObject *TEObj_get_selPoint(TEObject *self, void *closure)
 882{
 883	return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);
 884}
 885
 886#define TEObj_set_selPoint NULL
 887
 888static PyObject *TEObj_get_selStart(TEObject *self, void *closure)
 889{
 890	return Py_BuildValue("h", (*self->ob_itself)->selStart);
 891}
 892
 893#define TEObj_set_selStart NULL
 894
 895static PyObject *TEObj_get_selEnd(TEObject *self, void *closure)
 896{
 897	return Py_BuildValue("h", (*self->ob_itself)->selEnd);
 898}
 899
 900#define TEObj_set_selEnd NULL
 901
 902static PyObject *TEObj_get_active(TEObject *self, void *closure)
 903{
 904	return Py_BuildValue("h", (*self->ob_itself)->active);
 905}
 906
 907#define TEObj_set_active NULL
 908
 909static PyObject *TEObj_get_just(TEObject *self, void *closure)
 910{
 911	return Py_BuildValue("h", (*self->ob_itself)->just);
 912}
 913
 914#define TEObj_set_just NULL
 915
 916static PyObject *TEObj_get_teLength(TEObject *self, void *closure)
 917{
 918	return Py_BuildValue("h", (*self->ob_itself)->teLength);
 919}
 920
 921#define TEObj_set_teLength NULL
 922
 923static PyObject *TEObj_get_txFont(TEObject *self, void *closure)
 924{
 925	return Py_BuildValue("h", (*self->ob_itself)->txFont);
 926}
 927
 928#define TEObj_set_txFont NULL
 929
 930static PyObject *TEObj_get_txFace(TEObject *self, void *closure)
 931{
 932	return Py_BuildValue("h", (*self->ob_itself)->txFace);
 933}
 934
 935#define TEObj_set_txFace NULL
 936
 937static PyObject *TEObj_get_txMode(TEObject *self, void *closure)
 938{
 939	return Py_BuildValue("h", (*self->ob_itself)->txMode);
 940}
 941
 942#define TEObj_set_txMode NULL
 943
 944static PyObject *TEObj_get_txSize(TEObject *self, void *closure)
 945{
 946	return Py_BuildValue("h", (*self->ob_itself)->txSize);
 947}
 948
 949#define TEObj_set_txSize NULL
 950
 951static PyObject *TEObj_get_nLines(TEObject *self, void *closure)
 952{
 953	return Py_BuildValue("h", (*self->ob_itself)->nLines);
 954}
 955
 956#define TEObj_set_nLines NULL
 957
 958static PyGetSetDef TEObj_getsetlist[] = {
 959	{"destRect", (getter)TEObj_get_destRect, (setter)TEObj_set_destRect, "Destination rectangle"},
 960	{"viewRect", (getter)TEObj_get_viewRect, (setter)TEObj_set_viewRect, "Viewing rectangle"},
 961	{"selRect", (getter)TEObj_get_selRect, (setter)TEObj_set_selRect, "Selection rectangle"},
 962	{"lineHeight", (getter)TEObj_get_lineHeight, (setter)TEObj_set_lineHeight, "Height of a line"},
 963	{"fontAscent", (getter)TEObj_get_fontAscent, (setter)TEObj_set_fontAscent, "Ascent of a line"},
 964	{"selPoint", (getter)TEObj_get_selPoint, (setter)TEObj_set_selPoint, "Selection Point"},
 965	{"selStart", (getter)TEObj_get_selStart, (setter)TEObj_set_selStart, "Start of selection"},
 966	{"selEnd", (getter)TEObj_get_selEnd, (setter)TEObj_set_selEnd, "End of selection"},
 967	{"active", (getter)TEObj_get_active, (setter)TEObj_set_active, "TBD"},
 968	{"just", (getter)TEObj_get_just, (setter)TEObj_set_just, "Justification"},
 969	{"teLength", (getter)TEObj_get_teLength, (setter)TEObj_set_teLength, "TBD"},
 970	{"txFont", (getter)TEObj_get_txFont, (setter)TEObj_set_txFont, "Current font"},
 971	{"txFace", (getter)TEObj_get_txFace, (setter)TEObj_set_txFace, "Current font variant"},
 972	{"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"},
 973	{"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"},
 974	{"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"},
 975	{NULL, NULL, NULL, NULL},
 976};
 977
 978
 979#define TEObj_compare NULL
 980
 981#define TEObj_repr NULL
 982
 983#define TEObj_hash NULL
 984#define TEObj_tp_init 0
 985
 986#define TEObj_tp_alloc PyType_GenericAlloc
 987
 988static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
 989{
 990	PyObject *_self;
 991	TEHandle itself;
 992	char *kw[] = {"itself", 0};
 993
 994	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TEObj_Convert, &itself)) return NULL;
 995	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
 996	((TEObject *)_self)->ob_itself = itself;
 997	return _self;
 998}
 999
1000#define TEObj_tp_free PyObject_Del
1001
1002
1003PyTypeObject TE_Type = {
1004	PyObject_HEAD_INIT(NULL)
1005	0, /*ob_size*/
1006	"_TE.TE", /*tp_name*/
1007	sizeof(TEObject), /*tp_basicsize*/
1008	0, /*tp_itemsize*/
1009	/* methods */
1010	(destructor) TEObj_dealloc, /*tp_dealloc*/
1011	0, /*tp_print*/
1012	(getattrfunc)0, /*tp_getattr*/
1013	(setattrfunc)0, /*tp_setattr*/
1014	(cmpfunc) TEObj_compare, /*tp_compare*/
1015	(reprfunc) TEObj_repr, /*tp_repr*/
1016	(PyNumberMethods *)0, /* tp_as_number */
1017	(PySequenceMethods *)0, /* tp_as_sequence */
1018	(PyMappingMethods *)0, /* tp_as_mapping */
1019	(hashfunc) TEObj_hash, /*tp_hash*/
1020	0, /*tp_call*/
1021	0, /*tp_str*/
1022	PyObject_GenericGetAttr, /*tp_getattro*/
1023	PyObject_GenericSetAttr, /*tp_setattro */
1024	0, /*tp_as_buffer*/
1025	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
1026	0, /*tp_doc*/
1027	0, /*tp_traverse*/
1028	0, /*tp_clear*/
1029	0, /*tp_richcompare*/
1030	0, /*tp_weaklistoffset*/
1031	0, /*tp_iter*/
1032	0, /*tp_iternext*/
1033	TEObj_methods, /* tp_methods */
1034	0, /*tp_members*/
1035	TEObj_getsetlist, /*tp_getset*/
1036	0, /*tp_base*/
1037	0, /*tp_dict*/
1038	0, /*tp_descr_get*/
1039	0, /*tp_descr_set*/
1040	0, /*tp_dictoffset*/
1041	TEObj_tp_init, /* tp_init */
1042	TEObj_tp_alloc, /* tp_alloc */
1043	TEObj_tp_new, /* tp_new */
1044	TEObj_tp_free, /* tp_free */
1045};
1046
1047/* ----------------------- End object type TE ----------------------- */
1048
1049
1050static PyObject *TE_TEScrapHandle(PyObject *_self, PyObject *_args)
1051{
1052	PyObject *_res = NULL;
1053	Handle _rv;
1054#ifndef TEScrapHandle
1055	PyMac_PRECHECK(TEScrapHandle);
1056#endif
1057	if (!PyArg_ParseTuple(_args, ""))
1058		return NULL;
1059	_rv = TEScrapHandle();
1060	_res = Py_BuildValue("O&",
1061	                     ResObj_New, _rv);
1062	return _res;
1063}
1064
1065static PyObject *TE_TEGetScrapLength(PyObject *_self, PyObject *_args)
1066{
1067	PyObject *_res = NULL;
1068	long _rv;
1069#ifndef TEGetScrapLength
1070	PyMac_PRECHECK(TEGetScrapLength);
1071#endif
1072	if (!PyArg_ParseTuple(_args, ""))
1073		return NULL;
1074	_rv = TEGetScrapLength();
1075	_res = Py_BuildValue("l",
1076	                     _rv);
1077	return _res;
1078}
1079
1080static PyObject *TE_TENew(PyObject *_self, PyObject *_args)
1081{
1082	PyObject *_res = NULL;
1083	TEHandle _rv;
1084	Rect destRect;
1085	Rect viewRect;
1086#ifndef TENew
1087	PyMac_PRECHECK(TENew);
1088#endif
1089	if (!PyArg_ParseTuple(_args, "O&O&",
1090	                      PyMac_GetRect, &destRect,
1091	                      PyMac_GetRect, &viewRect))
1092		return NULL;
1093	_rv = TENew(&destRect,
1094	            &viewRect);
1095	_res = Py_BuildValue("O&",
1096	                     TEObj_New, _rv);
1097	return _res;
1098}
1099
1100static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args)
1101{
1102	PyObject *_res = NULL;
1103	char *text__in__;
1104	long text__len__;
1105	int text__in_len__;
1106	Rect box;
1107	short just;
1108#ifndef TETextBox
1109	PyMac_PRECHECK(TETextBox);
1110#endif
1111	if (!PyArg_ParseTuple(_args, "s#O&h",
1112	                      &text__in__, &text__in_len__,
1113	                      PyMac_GetRect, &box,
1114	                      &just))
1115		return NULL;
1116	text__len__ = text__in_len__;
1117	TETextBox(text__in__, text__len__,
1118	          &box,
1119	          just);
1120	Py_INCREF(Py_None);
1121	_res = Py_None;
1122	return _res;
1123}
1124
1125static PyObject *TE_TEStyleNew(PyObject *_self, PyObject *_args)
1126{
1127	PyObject *_res = NULL;
1128	TEHandle _rv;
1129	Rect destRect;
1130	Rect viewRect;
1131#ifndef TEStyleNew
1132	PyMac_PRECHECK(TEStyleNew);
1133#endif
1134	if (!PyArg_ParseTuple(_args, "O&O&",
1135	                      PyMac_GetRect, &destRect,
1136	                      PyMac_GetRect, &viewRect))
1137		return NULL;
1138	_rv = TEStyleNew(&destRect,
1139	                 &viewRect);
1140	_res = Py_BuildValue("O&",
1141	                     TEObj_New, _rv);
1142	return _res;
1143}
1144
1145static PyObject *TE_TESetScrapLength(PyObject *_self, PyObject *_args)
1146{
1147	PyObject *_res = NULL;
1148	long length;
1149#ifndef TESetScrapLength
1150	PyMac_PRECHECK(TESetScrapLength);
1151#endif
1152	if (!PyArg_ParseTuple(_args, "l",
1153	                      &length))
1154		return NULL;
1155	TESetScrapLength(length);
1156	Py_INCREF(Py_None);
1157	_res = Py_None;
1158	return _res;
1159}
1160
1161static PyObject *TE_TEFromScrap(PyObject *_self, PyObject *_args)
1162{
1163	PyObject *_res = NULL;
1164	OSErr _err;
1165#ifndef TEFromScrap
1166	PyMac_PRECHECK(TEFromScrap);
1167#endif
1168	if (!PyArg_ParseTuple(_args, ""))
1169		return NULL;
1170	_err = TEFromScrap();
1171	if (_err != noErr) return PyMac_Error(_err);
1172	Py_INCREF(Py_None);
1173	_res = Py_None;
1174	return _res;
1175}
1176
1177static PyObject *TE_TEToScrap(PyObject *_self, PyObject *_args)
1178{
1179	PyObject *_res = NULL;
1180	OSErr _err;
1181#ifndef TEToScrap
1182	PyMac_PRECHECK(TEToScrap);
1183#endif
1184	if (!PyArg_ParseTuple(_args, ""))
1185		return NULL;
1186	_err = TEToScrap();
1187	if (_err != noErr) return PyMac_Error(_err);
1188	Py_INCREF(Py_None);
1189	_res = Py_None;
1190	return _res;
1191}
1192
1193static PyObject *TE_TEGetScrapHandle(PyObject *_self, PyObject *_args)
1194{
1195	PyObject *_res = NULL;
1196	Handle _rv;
1197#ifndef TEGetScrapHandle
1198	PyMac_PRECHECK(TEGetScrapHandle);
1199#endif
1200	if (!PyArg_ParseTuple(_args, ""))
1201		return NULL;
1202	_rv = TEGetScrapHandle();
1203	_res = Py_BuildValue("O&",
1204	                     ResObj_New, _rv);
1205	return _res;
1206}
1207
1208static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args)
1209{
1210	PyObject *_res = NULL;
1211	Handle value;
1212#ifndef TESetScrapHandle
1213	PyMac_PRECHECK(TESetScrapHandle);
1214#endif
1215	if (!PyArg_ParseTuple(_args, "O&",
1216	                      ResObj_Convert, &value))
1217		return NULL;
1218	TESetScrapHandle(value);
1219	Py_INCREF(Py_None);
1220	_res = Py_None;
1221	return _res;
1222}
1223
1224static PyObject *TE_LMGetWordRedraw(PyObject *_self, PyObject *_args)
1225{
1226	PyObject *_res = NULL;
1227	UInt8 _rv;
1228#ifndef LMGetWordRedraw
1229	PyMac_PRECHECK(LMGetWordRedraw);
1230#endif
1231	if (!PyArg_ParseTuple(_args, ""))
1232		return NULL;
1233	_rv = LMGetWordRedraw();
1234	_res = Py_BuildValue("b",
1235	                     _rv);
1236	return _res;
1237}
1238
1239static PyObject *TE_LMSetWordRedraw(PyObject *_self, PyObject *_args)
1240{
1241	PyObject *_res = NULL;
1242	UInt8 value;
1243#ifndef LMSetWordRedraw
1244	PyMac_PRECHECK(LMSetWordRedraw);
1245#endif
1246	if (!PyArg_ParseTuple(_args, "b",
1247	                      &value))
1248		return NULL;
1249	LMSetWordRedraw(value);
1250	Py_INCREF(Py_None);
1251	_res = Py_None;
1252	return _res;
1253}
1254
1255static PyObject *TE_as_TE(PyObject *_self, PyObject *_args)
1256{
1257	PyObject *_res = NULL;
1258	TEHandle _rv;
1259	Handle h;
1260#ifndef as_TE
1261	PyMac_PRECHECK(as_TE);
1262#endif
1263	if (!PyArg_ParseTuple(_args, "O&",
1264	                      ResObj_Convert, &h))
1265		return NULL;
1266	_rv = as_TE(h);
1267	_res = Py_BuildValue("O&",
1268	                     TEObj_New, _rv);
1269	return _res;
1270}
1271#endif /* __LP64__ */
1272
1273static PyMethodDef TE_methods[] = {
1274#ifndef __LP64__
1275	{"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1,
1276	 PyDoc_STR("() -> (Handle _rv)")},
1277	{"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1,
1278	 PyDoc_STR("() -> (long _rv)")},
1279	{"TENew", (PyCFunction)TE_TENew, 1,
1280	 PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")},
1281	{"TETextBox", (PyCFunction)TE_TETextBox, 1,
1282	 PyDoc_STR("(Buffer text, Rect box, short just) -> None")},
1283	{"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1,
1284	 PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")},
1285	{"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1,
1286	 PyDoc_STR("(long length) -> None")},
1287	{"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1,
1288	 PyDoc_STR("() -> None")},
1289	{"TEToScrap", (PyCFunction)TE_TEToScrap, 1,
1290	 PyDoc_STR("() -> None")},
1291	{"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1,
1292	 PyDoc_STR("() -> (Handle _rv)")},
1293	{"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1,
1294	 PyDoc_STR("(Handle value) -> None")},
1295	{"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1,
1296	 PyDoc_STR("() -> (UInt8 _rv)")},
1297	{"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1,
1298	 PyDoc_STR("(UInt8 value) -> None")},
1299	{"as_TE", (PyCFunction)TE_as_TE, 1,
1300	 PyDoc_STR("(Handle h) -> (TEHandle _rv)")},
1301#endif /* __LP64__ */
1302	{NULL, NULL, 0}
1303};
1304
1305
1306
1307
1308void init_TE(void)
1309{
1310	PyObject *m;
1311#ifndef __LP64__
1312	PyObject *d;
1313
1314
1315
1316	        PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New);
1317	        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert);
1318
1319#endif /* __LP64__ */
1320
1321	m = Py_InitModule("_TE", TE_methods);
1322#ifndef __LP64__
1323	d = PyModule_GetDict(m);
1324	TE_Error = PyMac_GetOSErrException();
1325	if (TE_Error == NULL ||
1326	    PyDict_SetItemString(d, "Error", TE_Error) != 0)
1327		return;
1328	TE_Type.ob_type = &PyType_Type;
1329	if (PyType_Ready(&TE_Type) < 0) return;
1330	Py_INCREF(&TE_Type);
1331	PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
1332	/* Backward-compatible name */
1333	Py_INCREF(&TE_Type);
1334	PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
1335#endif /* __LP64__ */
1336}
1337
1338/* ========================= End module _TE ========================= */
1339