[Python-checkins] python/dist/src/Mac/Modules/app _Appmodule.c,1.13,1.14 appsupport.py,1.16,1.17

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Tue, 03 Dec 2002 15:40:51 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/app
In directory sc8-pr-cvs1:/tmp/cvs-serv10318/app

Modified Files:
	_Appmodule.c appsupport.py 
Log Message:
Added PEP253 support to most Carbon modules. This isn't complete yet:
some of the more compilcated cases (CF, Res) haven't been done yet. Also,
various types should inherit from each other (anything with an as_Resource
method should be a Resource subtype, the CF types should become one family).


Index: _Appmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** _Appmodule.c	29 Nov 2002 23:40:41 -0000	1.13
--- _Appmodule.c	3 Dec 2002 23:40:18 -0000	1.14
***************
*** 116,119 ****
--- 116,120 ----
  #define ThemeDrawingStateObj_getsetlist NULL
  
+ 
  #define ThemeDrawingStateObj_compare NULL
  
***************
*** 121,124 ****
--- 122,143 ----
  
  #define ThemeDrawingStateObj_hash NULL
+ #define ThemeDrawingStateObj_tp_init 0
+ 
+ #define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc
+ 
+ static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ {
+ 	PyObject *self;
+ 	ThemeDrawingState itself;
+ 	char *kw[] = {"itself", 0};
+ 
+ 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
+ 	if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ 	((ThemeDrawingStateObject *)self)->ob_itself = itself;
+ 	return self;
+ }
+ 
+ #define ThemeDrawingStateObj_tp_free PyObject_Del
+ 
  
  PyTypeObject ThemeDrawingState_Type = {
***************
*** 143,159 ****
  	PyObject_GenericGetAttr, /*tp_getattro*/
  	PyObject_GenericSetAttr, /*tp_setattro */
! 	0, /*outputHook_tp_as_buffer*/
! 	0, /*outputHook_tp_flags*/
! 	0, /*outputHook_tp_doc*/
! 	0, /*outputHook_tp_traverse*/
! 	0, /*outputHook_tp_clear*/
! 	0, /*outputHook_tp_richcompare*/
! 	0, /*outputHook_tp_weaklistoffset*/
! 	0, /*outputHook_tp_iter*/
! 	0, /*outputHook_tp_iternext*/
  	ThemeDrawingStateObj_methods, /* tp_methods */
! 	0, /*outputHook_tp_members*/
  	ThemeDrawingStateObj_getsetlist, /*tp_getset*/
! 	0, /*outputHook_tp_base*/
  };
  
--- 162,186 ----
  	PyObject_GenericGetAttr, /*tp_getattro*/
  	PyObject_GenericSetAttr, /*tp_setattro */
! 	0, /*tp_as_buffer*/
! 	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
! 	0, /*tp_doc*/
! 	0, /*tp_traverse*/
! 	0, /*tp_clear*/
! 	0, /*tp_richcompare*/
! 	0, /*tp_weaklistoffset*/
! 	0, /*tp_iter*/
! 	0, /*tp_iternext*/
  	ThemeDrawingStateObj_methods, /* tp_methods */
! 	0, /*tp_members*/
  	ThemeDrawingStateObj_getsetlist, /*tp_getset*/
! 	0, /*tp_base*/
! 	0, /*tp_dict*/
! 	0, /*tp_descr_get*/
! 	0, /*tp_descr_set*/
! 	0, /*tp_dictoffset*/
! 	ThemeDrawingStateObj_tp_init, /* tp_init */
! 	ThemeDrawingStateObj_tp_alloc, /* tp_alloc */
! 	ThemeDrawingStateObj_tp_new, /* tp_new */
! 	ThemeDrawingStateObj_tp_free, /* tp_free */
  };
  
***************
*** 1823,1828 ****
  	ThemeDrawingState_Type.ob_type = &PyType_Type;
  	Py_INCREF(&ThemeDrawingState_Type);
! 	if (PyDict_SetItemString(d, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type) != 0)
! 		Py_FatalError("can't initialize ThemeDrawingStateType");
  }
  
--- 1850,1857 ----
  	ThemeDrawingState_Type.ob_type = &PyType_Type;
  	Py_INCREF(&ThemeDrawingState_Type);
! 	PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
! 	/* Backward-compatible name */
! 	Py_INCREF(&ThemeDrawingState_Type);
! 	PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type);
  }
  

Index: appsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** appsupport.py	29 Nov 2002 23:40:41 -0000	1.16
--- appsupport.py	3 Dec 2002 23:40:19 -0000	1.17
***************
*** 95,99 ****
  """
  
! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
  	pass
  ## 	def outputCheckNewArg(self):
--- 95,99 ----
  """
  
! class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
  	pass
  ## 	def outputCheckNewArg(self):