[Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenObjectDefinition.py,1.14,1.15

Jack Jansen jackjansen@users.sourceforge.net
Sun, 09 Dec 2001 15:25:02 -0800


Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory usw-pr-cvs1:/tmp/cvs-serv26311/Python/Tools/bgen/bgen

Modified Files:
	bgenObjectDefinition.py 
Log Message:
The module generator now tells its object generators about the module name (through the new setmodulename() method). If the module name has been set the object generators output it as part of the tp_name field for the object type.

Index: bgenObjectDefinition.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenObjectDefinition.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** bgenObjectDefinition.py	2001/11/14 15:48:13	1.14
--- bgenObjectDefinition.py	2001/12/09 23:25:00	1.15
***************
*** 23,26 ****
--- 23,27 ----
  		self.argref = ""	# set to "*" if arg to <type>_New should be pointer
  		self.static = "static " # set to "" to make <type>_New and <type>_Convert public
+ 		self.modulename = None
  
  	def add(self, g, dupcheck=0):
***************
*** 31,34 ****
--- 32,38 ----
  		# In case we are referenced from a module
  		pass
+ 		
+ 	def setmodulename(self, name):
+ 		self.modulename = name
  
  	def generate(self):
***************
*** 167,171 ****
  		Output("PyObject_HEAD_INIT(NULL)")
  		Output("0, /*ob_size*/")
! 		Output("\"%s\", /*tp_name*/", self.name)
  		Output("sizeof(%s), /*tp_basicsize*/", self.objecttype)
  		Output("0, /*tp_itemsize*/")
--- 171,178 ----
  		Output("PyObject_HEAD_INIT(NULL)")
  		Output("0, /*ob_size*/")
! 		if self.modulename:
! 			Output("\"%s.%s\", /*tp_name*/", self.modulename, self.name)
! 		else:
! 			Output("\"%s\", /*tp_name*/", self.name)
  		Output("sizeof(%s), /*tp_basicsize*/", self.objecttype)
  		Output("0, /*tp_itemsize*/")