[Python-checkins] python/dist/src/Lib/plat-irix6 AL.py, 1.1, 1.2 CD.py, 1.1, 1.2 CL.py, 1.1, 1.2 FILE.py, 1.2, 1.3 FL.py, 1.2, 1.3 SV.py, 1.1, 1.2 cddb.py, 1.5, 1.6 cdplayer.py, 1.6, 1.7 flp.py, 1.9, 1.10 jpeg.py, 1.4, 1.5 panel.py, 1.4, 1.5 panelparser.py, 1.2, 1.3 readcd.py, 1.4, 1.5 torgb.py, 1.6, 1.7

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sun Jul 18 08:15:19 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/plat-irix6
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31286/plat-irix6

Modified Files:
	AL.py CD.py CL.py FILE.py FL.py SV.py cddb.py cdplayer.py 
	flp.py jpeg.py panel.py panelparser.py readcd.py torgb.py 
Log Message:
Whitespace normalization, via reindent.py.


Index: AL.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/AL.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AL.py	15 Jan 1997 19:18:26 -0000	1.1
--- AL.py	18 Jul 2004 06:14:44 -0000	1.2
***************
*** 1,61 ****
! RATE_48000 	= 48000
! RATE_44100	= 44100
! RATE_32000	= 32000
! RATE_22050	= 22050
! RATE_16000	= 16000
! RATE_11025	= 11025
! RATE_8000	= 8000
  
  SAMPFMT_TWOSCOMP= 1
! SAMPFMT_FLOAT	= 32
! SAMPFMT_DOUBLE	= 64
  
! SAMPLE_8	= 1
! SAMPLE_16	= 2
! 	# SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits
! SAMPLE_24	= 4
  
! MONO		= 1
! STEREO		= 2
! QUADRO		= 4			# 4CHANNEL is not a legal Python name
  
! INPUT_LINE	= 0
! INPUT_MIC	= 1
! INPUT_DIGITAL	= 2
  
! MONITOR_OFF	= 0
! MONITOR_ON	= 1
  
! ERROR_NUMBER		= 0
! ERROR_TYPE		= 1
! ERROR_LOCATION_LSP 	= 2
! ERROR_LOCATION_MSP	= 3
! ERROR_LENGTH		= 4
  
! ERROR_INPUT_UNDERFLOW	= 0
! ERROR_OUTPUT_OVERFLOW	= 1
  
  # These seem to be not supported anymore:
! ##HOLD, RELEASE			= 0, 1
! ##ATTAIL, ATHEAD, ATMARK, ATTIME	= 0, 1, 2, 3
  
! DEFAULT_DEVICE	= 1
  
! INPUT_SOURCE		= 0
! LEFT_INPUT_ATTEN	= 1
! RIGHT_INPUT_ATTEN	= 2
! INPUT_RATE		= 3
! OUTPUT_RATE		= 4
! LEFT_SPEAKER_GAIN	= 5
! RIGHT_SPEAKER_GAIN	= 6
! INPUT_COUNT		= 7
! OUTPUT_COUNT		= 8
! UNUSED_COUNT		= 9
! SYNC_INPUT_TO_AES	= 10
! SYNC_OUTPUT_TO_AES	= 11
! MONITOR_CTL		= 12
! LEFT_MONITOR_ATTEN	= 13
! RIGHT_MONITOR_ATTEN	= 14
  
! ENUM_VALUE	= 0	# only certain values are valid
! RANGE_VALUE	= 1	# any value in range is valid
--- 1,61 ----
! RATE_48000      = 48000
! RATE_44100      = 44100
! RATE_32000      = 32000
! RATE_22050      = 22050
! RATE_16000      = 16000
! RATE_11025      = 11025
! RATE_8000       = 8000
  
  SAMPFMT_TWOSCOMP= 1
! SAMPFMT_FLOAT   = 32
! SAMPFMT_DOUBLE  = 64
  
! SAMPLE_8        = 1
! SAMPLE_16       = 2
!         # SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits
! SAMPLE_24       = 4
  
! MONO            = 1
! STEREO          = 2
! QUADRO          = 4                     # 4CHANNEL is not a legal Python name
  
! INPUT_LINE      = 0
! INPUT_MIC       = 1
! INPUT_DIGITAL   = 2
  
! MONITOR_OFF     = 0
! MONITOR_ON      = 1
  
! ERROR_NUMBER            = 0
! ERROR_TYPE              = 1
! ERROR_LOCATION_LSP      = 2
! ERROR_LOCATION_MSP      = 3
! ERROR_LENGTH            = 4
  
! ERROR_INPUT_UNDERFLOW   = 0
! ERROR_OUTPUT_OVERFLOW   = 1
  
  # These seem to be not supported anymore:
! ##HOLD, RELEASE                 = 0, 1
! ##ATTAIL, ATHEAD, ATMARK, ATTIME        = 0, 1, 2, 3
  
! DEFAULT_DEVICE  = 1
  
! INPUT_SOURCE            = 0
! LEFT_INPUT_ATTEN        = 1
! RIGHT_INPUT_ATTEN       = 2
! INPUT_RATE              = 3
! OUTPUT_RATE             = 4
! LEFT_SPEAKER_GAIN       = 5
! RIGHT_SPEAKER_GAIN      = 6
! INPUT_COUNT             = 7
! OUTPUT_COUNT            = 8
! UNUSED_COUNT            = 9
! SYNC_INPUT_TO_AES       = 10
! SYNC_OUTPUT_TO_AES      = 11
! MONITOR_CTL             = 12
! LEFT_MONITOR_ATTEN      = 13
! RIGHT_MONITOR_ATTEN     = 14
  
! ENUM_VALUE      = 0     # only certain values are valid
! RANGE_VALUE     = 1     # any value in range is valid

Index: CD.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/CD.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CD.py	15 Jan 1997 19:18:33 -0000	1.1
--- CD.py	18 Jul 2004 06:14:45 -0000	1.2
***************
*** 1,34 ****
! ERROR		= 0
! NODISC		= 1
! READY		= 2
! PLAYING		= 3
! PAUSED		= 4
! STILL		= 5
  
! AUDIO		= 0
! PNUM		= 1
! INDEX		= 2
! PTIME		= 3
! ATIME		= 4
! CATALOG		= 5
! IDENT		= 6
! CONTROL		= 7
  
! CDDA_DATASIZE	= 2352
  
! ##CDDA_SUBCODESIZE	= (sizeof(struct subcodeQ))
! ##CDDA_BLOCKSIZE	= (sizeof(struct cdframe))
! ##CDDA_NUMSAMPLES	= (CDDA_DATASIZE/2)
  ##
! ##CDQ_PREEMP_MASK	= 0xd
! ##CDQ_COPY_MASK	= 0xb
! ##CDQ_DDATA_MASK	= 0xd
! ##CDQ_BROADCAST_MASK	= 0x8
! ##CDQ_PREEMPHASIS	= 0x1
! ##CDQ_COPY_PERMITTED	= 0x2		
! ##CDQ_DIGITAL_DATA	= 0x4
! ##CDQ_BROADCAST_USE	= 0x8
  ##
! ##CDQ_MODE1	= 0x1
! ##CDQ_MODE2	= 0x2
! ##CDQ_MODE3	= 0x3
--- 1,34 ----
! ERROR           = 0
! NODISC          = 1
! READY           = 2
! PLAYING         = 3
! PAUSED          = 4
! STILL           = 5
  
! AUDIO           = 0
! PNUM            = 1
! INDEX           = 2
! PTIME           = 3
! ATIME           = 4
! CATALOG         = 5
! IDENT           = 6
! CONTROL         = 7
  
! CDDA_DATASIZE   = 2352
  
! ##CDDA_SUBCODESIZE      = (sizeof(struct subcodeQ))
! ##CDDA_BLOCKSIZE        = (sizeof(struct cdframe))
! ##CDDA_NUMSAMPLES       = (CDDA_DATASIZE/2)
  ##
! ##CDQ_PREEMP_MASK       = 0xd
! ##CDQ_COPY_MASK = 0xb
! ##CDQ_DDATA_MASK        = 0xd
! ##CDQ_BROADCAST_MASK    = 0x8
! ##CDQ_PREEMPHASIS       = 0x1
! ##CDQ_COPY_PERMITTED    = 0x2
! ##CDQ_DIGITAL_DATA      = 0x4
! ##CDQ_BROADCAST_USE     = 0x8
  ##
! ##CDQ_MODE1     = 0x1
! ##CDQ_MODE2     = 0x2
! ##CDQ_MODE3     = 0x3

Index: CL.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/CL.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CL.py	15 Jan 1997 19:18:35 -0000	1.1
--- CL.py	18 Jul 2004 06:14:45 -0000	1.2
***************
*** 2,24 ****
  # All relevant symbols are now defined in the module cl.
  try:
! 	from cl import *
  except ImportError:
! 	from CL_old import *
  else:
! 	del CompressImage
! 	del DecompressImage
! 	del GetAlgorithmName
! 	del OpenCompressor
! 	del OpenDecompressor
! 	del QueryAlgorithms
! 	del QueryMaxHeaderSize
! 	del QueryScheme
! 	del QuerySchemeFromName
! 	del SetDefault
! 	del SetMax
! 	del SetMin
! 	try:
! 		del cvt_type
! 	except NameError:
! 		pass
! 	del error
--- 2,24 ----
  # All relevant symbols are now defined in the module cl.
  try:
!     from cl import *
  except ImportError:
!     from CL_old import *
  else:
!     del CompressImage
!     del DecompressImage
!     del GetAlgorithmName
!     del OpenCompressor
!     del OpenDecompressor
!     del QueryAlgorithms
!     del QueryMaxHeaderSize
!     del QueryScheme
!     del QuerySchemeFromName
!     del SetDefault
!     del SetMax
!     del SetMin
!     try:
!         del cvt_type
!     except NameError:
!         pass
!     del error

Index: FILE.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/FILE.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FILE.py	17 Mar 2002 21:49:20 -0000	1.2
--- FILE.py	18 Jul 2004 06:14:45 -0000	1.3
***************
*** 442,446 ****
  def OFFTOBBT(bytes): return ((off_t)(bytes) >> BBSHIFT)
  
! def BBTOOFF(bbs): return ((off_t)(bbs) << BBSHIFT)     
  
  SEEKLIMIT32 = 0x7fffffff
--- 442,446 ----
  def OFFTOBBT(bytes): return ((off_t)(bytes) >> BBSHIFT)
  
! def BBTOOFF(bbs): return ((off_t)(bbs) << BBSHIFT)
  
  SEEKLIMIT32 = 0x7fffffff
***************
*** 490,496 ****
  MRLOCK_ALLOW_EQUAL_PRI = 0x8
  MRLOCK_DEFAULT = MRLOCK_BARRIER
! def mraccess(mrp): return mraccessf(mrp, 0)	 
  
! def mrupdate(mrp): return mrupdatef(mrp, 0)	 
  
  def mp_mutex_unlock(m): return mutex_unlock(m)
--- 490,496 ----
  MRLOCK_ALLOW_EQUAL_PRI = 0x8
  MRLOCK_DEFAULT = MRLOCK_BARRIER
! def mraccess(mrp): return mraccessf(mrp, 0)
  
! def mrupdate(mrp): return mrupdatef(mrp, 0)
  
  def mp_mutex_unlock(m): return mutex_unlock(m)

Index: FL.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/FL.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FL.py	12 Dec 2000 23:11:42 -0000	1.2
--- FL.py	18 Jul 2004 06:14:45 -0000	1.3
***************
*** 8,14 ****
  ##import fl
  ##try:
! ##	_v20 = (fl.get_rgbmode is not None)
  ##except:
! ##	_v20 = 0
  ##del fl
  
--- 8,14 ----
  ##import fl
  ##try:
! ##      _v20 = (fl.get_rgbmode is not None)
  ##except:
! ##      _v20 = 0
  ##del fl
  
***************
*** 21,25 ****
  LABEL_SIZE = 64
  if _v20:
! 	SHORTCUT_SIZE = 32
  PLACE_FREE = 0
  PLACE_SIZE = 1
--- 21,25 ----
  LABEL_SIZE = 64
  if _v20:
!     SHORTCUT_SIZE = 32
  PLACE_FREE = 0
  PLACE_SIZE = 1
***************
*** 120,124 ****
  RETURN_BUTTON = 6
  if _v20:
! 	HIDDEN_RET_BUTTON = 7
  BUTTON_BOXTYPE = UP_BOX
  BUTTON_COL1 = COL1
--- 120,124 ----
  RETURN_BUTTON = 6
  if _v20:
!     HIDDEN_RET_BUTTON = 7
  BUTTON_BOXTYPE = UP_BOX
  BUTTON_COL1 = COL1
***************
*** 130,147 ****
  BUTTON_BW = BOUND_WIDTH
  if _v20:
! 	CHART = 4
! 	BAR_CHART = 0
! 	HORBAR_CHART = 1
! 	LINE_CHART = 2
! 	FILLED_CHART = 3
! 	SPIKE_CHART = 4
! 	PIE_CHART = 5
! 	SPECIALPIE_CHART = 6
! 	CHART_BOXTYPE = BORDER_BOX
! 	CHART_COL1 = COL1
! 	CHART_LCOL = LCOL
! 	CHART_ALIGN = ALIGN_BOTTOM
! 	CHART_BW = BOUND_WIDTH
! 	CHART_MAX = 128
  CHOICE = 42
  NORMAL_CHOICE = 0
--- 130,147 ----
  BUTTON_BW = BOUND_WIDTH
  if _v20:
!     CHART = 4
!     BAR_CHART = 0
!     HORBAR_CHART = 1
!     LINE_CHART = 2
!     FILLED_CHART = 3
!     SPIKE_CHART = 4
!     PIE_CHART = 5
!     SPECIALPIE_CHART = 6
!     CHART_BOXTYPE = BORDER_BOX
!     CHART_COL1 = COL1
!     CHART_LCOL = LCOL
!     CHART_ALIGN = ALIGN_BOTTOM
!     CHART_BW = BOUND_WIDTH
!     CHART_MAX = 128
  CHOICE = 42
  NORMAL_CHOICE = 0
***************
*** 174,182 ****
  COUNTER_ALIGN = ALIGN_BOTTOM
  if _v20:
! 	COUNTER_BW = BOUND_WIDTH
  else:
! 	DEFAULT = 51
! 	RETURN_DEFAULT = 0
! 	ALWAYS_DEFAULT = 1
  DIAL = 22
  NORMAL_DIAL = 0
--- 174,182 ----
  COUNTER_ALIGN = ALIGN_BOTTOM
  if _v20:
!     COUNTER_BW = BOUND_WIDTH
  else:
!     DEFAULT = 51
!     RETURN_DEFAULT = 0
!     ALWAYS_DEFAULT = 1
  DIAL = 22
  NORMAL_DIAL = 0
***************
*** 198,209 ****
  NORMAL_INPUT = 0
  if _v20:
! 	FLOAT_INPUT = 1
! 	INT_INPUT = 2
! 	HIDDEN_INPUT = 3
! 	if _v21:
! 		MULTILINE_INPUT = 4
! 		SECRET_INPUT = 5
  else:
! 	ALWAYS_INPUT = 1
  INPUT_BOXTYPE = DOWN_BOX
  INPUT_COL1 = 13
--- 198,209 ----
  NORMAL_INPUT = 0
  if _v20:
!     FLOAT_INPUT = 1
!     INT_INPUT = 2
!     HIDDEN_INPUT = 3
!     if _v21:
!         MULTILINE_INPUT = 4
!         SECRET_INPUT = 5
  else:
!     ALWAYS_INPUT = 1
  INPUT_BOXTYPE = DOWN_BOX
  INPUT_COL1 = 13

Index: SV.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/SV.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SV.py	15 Jan 1997 19:18:56 -0000	1.1
--- SV.py	18 Jul 2004 06:14:45 -0000	1.2
***************
*** 8,21 ****
  
  # mode parameter for Bind calls
! IN_OFF = 0				# No Video
! IN_OVER = 1				# Video over graphics
! IN_UNDER = 2				# Video under graphics
! IN_REPLACE = 3				# Video replaces entire win
  
  # mode parameters for LoadMap calls.  Specifies buffer, always 256 entries
! INPUT_COLORMAP = 0			# tuples of 8-bit RGB
! CHROMA_KEY_MAP = 1			# tuples of 8-bit RGB
! COLOR_SPACE_MAP = 2			# tuples of 8-bit RGB
! GAMMA_MAP = 3				# tuples of 24-bit red values
  
  # mode parameters for UseExclusive calls
--- 8,21 ----
  
  # mode parameter for Bind calls
! IN_OFF = 0                              # No Video
! IN_OVER = 1                             # Video over graphics
! IN_UNDER = 2                            # Video under graphics
! IN_REPLACE = 3                          # Video replaces entire win
  
  # mode parameters for LoadMap calls.  Specifies buffer, always 256 entries
! INPUT_COLORMAP = 0                      # tuples of 8-bit RGB
! CHROMA_KEY_MAP = 1                      # tuples of 8-bit RGB
! COLOR_SPACE_MAP = 2                     # tuples of 8-bit RGB
! GAMMA_MAP = 3                           # tuples of 24-bit red values
  
  # mode parameters for UseExclusive calls
***************
*** 25,31 ****
  
  # Format constants for the capture routines
! RGB8_FRAMES = 0				# noninterleaved 8 bit 3:2:3 RBG fields
! RGB32_FRAMES = 1			# 32-bit 8:8:8 RGB frames
! YUV411_FRAMES = 2			# interleaved, 8:2:2 YUV format
  YUV411_FRAMES_AND_BLANKING_BUFFER = 3
  
--- 25,31 ----
  
  # Format constants for the capture routines
! RGB8_FRAMES = 0                         # noninterleaved 8 bit 3:2:3 RBG fields
! RGB32_FRAMES = 1                        # 32-bit 8:8:8 RGB frames
! YUV411_FRAMES = 2                       # interleaved, 8:2:2 YUV format
  YUV411_FRAMES_AND_BLANKING_BUFFER = 3
  

Index: cddb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/cddb.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** cddb.py	3 Mar 2004 16:34:31 -0000	1.5
--- cddb.py	18 Jul 2004 06:14:45 -0000	1.6
***************
*** 21,204 ****
  _dbid_map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ at _=+abcdefghijklmnopqrstuvwxyz'
  def _dbid(v):
! 	if v >= len(_dbid_map):
! 		return string.zfill(v, 2)
! 	else:
! 		return _dbid_map[v]
  
  def tochash(toc):
! 	if type(toc) == type(''):
! 		tracklist = []
! 		for i in range(2, len(toc), 4):
! 			tracklist.append((None,
! 				  (int(toc[i:i+2]),
! 				   int(toc[i+2:i+4]))))
! 	else:
! 		tracklist = toc
! 	ntracks = len(tracklist)
! 	hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
! 	if ntracks <= _DB_ID_NTRACKS:
! 		nidtracks = ntracks
! 	else:
! 		nidtracks = _DB_ID_NTRACKS - 1
! 		min = 0
! 		sec = 0
! 		for track in tracklist:
! 			start, length = track
! 			min = min + length[0]
! 			sec = sec + length[1]
! 		min = min + sec / 60
! 		sec = sec % 60
! 		hash = hash + _dbid(min) + _dbid(sec)
! 	for i in range(nidtracks):
! 		start, length = tracklist[i]
! 		hash = hash + _dbid(length[0]) + _dbid(length[1])
! 	return hash
! 	
  class Cddb:
! 	def __init__(self, tracklist):
! 		if os.environ.has_key('CDDB_PATH'):
! 			path = os.environ['CDDB_PATH']
! 			cddb_path = path.split(',')
! 		else:
! 			home = os.environ['HOME']
! 			cddb_path = [home + '/' + _cddbrc]
  
! 		self._get_id(tracklist)
  
! 		for dir in cddb_path:
! 			file = dir + '/' + self.id + '.rdb'
! 			try:
! 				f = open(file, 'r')
! 				self.file = file
! 				break
! 			except IOError:
! 				pass
! 		ntracks = int(self.id[:2], 16)
! 		self.artist = ''
! 		self.title = ''
! 		self.track = [None] + [''] * ntracks
! 		self.trackartist = [None] + [''] * ntracks
! 		self.notes = []
! 		if not hasattr(self, 'file'):
! 			return
! 		import re
! 		reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)')
! 		while 1:
! 			line = f.readline()
! 			if not line:
! 				break
! 			match = reg.match(line)
! 			if not match:
! 				print 'syntax error in ' + file
! 				continue
! 			name1, name2, value = match.group(1, 2, 3)
! 			if name1 == 'album':
! 				if name2 == 'artist':
! 					self.artist = value
! 				elif name2 == 'title':
! 					self.title = value
! 				elif name2 == 'toc':
! 					if not self.toc:
! 						self.toc = value
! 					if self.toc != value:
! 						print 'toc\'s don\'t match'
! 				elif name2 == 'notes':
! 					self.notes.append(value)
! 			elif name1[:5] == 'track':
! 				try:
! 					trackno = int(name1[5:])
! 				except ValueError:
! 					print 'syntax error in ' + file
! 					continue
! 				if trackno > ntracks:
! 					print 'track number %r in file %s out of range' % (trackno, file)
! 					continue
! 				if name2 == 'title':
! 					self.track[trackno] = value
! 				elif name2 == 'artist':
! 					self.trackartist[trackno] = value
! 		f.close()
! 		for i in range(2, len(self.track)):
! 			track = self.track[i]
! 			# if track title starts with `,', use initial part
! 			# of previous track's title
! 			if track and track[0] == ',':
! 				try:
! 					off = self.track[i - 1].index(',')
! 				except ValueError:
! 					pass
! 				else:
! 					self.track[i] = self.track[i-1][:off] \
! 							+ track
  
! 	def _get_id(self, tracklist):
! 		# fill in self.id and self.toc.
! 		# if the argument is a string ending in .rdb, the part
! 		# upto the suffix is taken as the id.
! 		if type(tracklist) == type(''):
! 			if tracklist[-4:] == '.rdb':
! 				self.id = tracklist[:-4]
! 				self.toc = ''
! 				return
! 			t = []
! 			for i in range(2, len(tracklist), 4):
! 				t.append((None, \
! 					  (int(tracklist[i:i+2]), \
! 					   int(tracklist[i+2:i+4]))))
! 			tracklist = t
! 		ntracks = len(tracklist)
! 		self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
! 		if ntracks <= _DB_ID_NTRACKS:
! 			nidtracks = ntracks
! 		else:
! 			nidtracks = _DB_ID_NTRACKS - 1
! 			min = 0
! 			sec = 0
! 			for track in tracklist:
! 				start, length = track
! 				min = min + length[0]
! 				sec = sec + length[1]
! 			min = min + sec / 60
! 			sec = sec % 60
! 			self.id = self.id + _dbid(min) + _dbid(sec)
! 		for i in range(nidtracks):
! 			start, length = tracklist[i]
! 			self.id = self.id + _dbid(length[0]) + _dbid(length[1])
! 		self.toc = string.zfill(ntracks, 2)
! 		for track in tracklist:
! 			start, length = track
! 			self.toc = self.toc + string.zfill(length[0], 2) + \
! 				  string.zfill(length[1], 2)
  
! 	def write(self):
! 		import posixpath
! 		if os.environ.has_key('CDDB_WRITE_DIR'):
! 			dir = os.environ['CDDB_WRITE_DIR']
! 		else:
! 			dir = os.environ['HOME'] + '/' + _cddbrc
! 		file = dir + '/' + self.id + '.rdb'
! 		if posixpath.exists(file):
! 			# make backup copy
! 			posix.rename(file, file + '~')
! 		f = open(file, 'w')
! 		f.write('album.title:\t' + self.title + '\n')
! 		f.write('album.artist:\t' + self.artist + '\n')
! 		f.write('album.toc:\t' + self.toc + '\n')
! 		for note in self.notes:
! 			f.write('album.notes:\t' + note + '\n')
! 		prevpref = None
! 		for i in range(1, len(self.track)):
! 			if self.trackartist[i]:
! 				f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i]))
! 			track = self.track[i]
! 			try:
! 				off = track.index(',')
! 			except ValueError:
! 				prevpref = None
! 			else:
! 				if prevpref and track[:off] == prevpref:
! 					track = track[off:]
! 				else:
! 					prevpref = track[:off]
! 			f.write('track%r.title:\t%s\n' % (i, track))
! 		f.close()
--- 21,204 ----
  _dbid_map = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ at _=+abcdefghijklmnopqrstuvwxyz'
  def _dbid(v):
!     if v >= len(_dbid_map):
!         return string.zfill(v, 2)
!     else:
!         return _dbid_map[v]
  
  def tochash(toc):
!     if type(toc) == type(''):
!         tracklist = []
!         for i in range(2, len(toc), 4):
!             tracklist.append((None,
!                       (int(toc[i:i+2]),
!                        int(toc[i+2:i+4]))))
!     else:
!         tracklist = toc
!     ntracks = len(tracklist)
!     hash = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
!     if ntracks <= _DB_ID_NTRACKS:
!         nidtracks = ntracks
!     else:
!         nidtracks = _DB_ID_NTRACKS - 1
!         min = 0
!         sec = 0
!         for track in tracklist:
!             start, length = track
!             min = min + length[0]
!             sec = sec + length[1]
!         min = min + sec / 60
!         sec = sec % 60
!         hash = hash + _dbid(min) + _dbid(sec)
!     for i in range(nidtracks):
!         start, length = tracklist[i]
!         hash = hash + _dbid(length[0]) + _dbid(length[1])
!     return hash
! 
  class Cddb:
!     def __init__(self, tracklist):
!         if os.environ.has_key('CDDB_PATH'):
!             path = os.environ['CDDB_PATH']
!             cddb_path = path.split(',')
!         else:
!             home = os.environ['HOME']
!             cddb_path = [home + '/' + _cddbrc]
  
!         self._get_id(tracklist)
  
!         for dir in cddb_path:
!             file = dir + '/' + self.id + '.rdb'
!             try:
!                 f = open(file, 'r')
!                 self.file = file
!                 break
!             except IOError:
!                 pass
!         ntracks = int(self.id[:2], 16)
!         self.artist = ''
!         self.title = ''
!         self.track = [None] + [''] * ntracks
!         self.trackartist = [None] + [''] * ntracks
!         self.notes = []
!         if not hasattr(self, 'file'):
!             return
!         import re
!         reg = re.compile(r'^([^.]*)\.([^:]*):[\t ]+(.*)')
!         while 1:
!             line = f.readline()
!             if not line:
!                 break
!             match = reg.match(line)
!             if not match:
!                 print 'syntax error in ' + file
!                 continue
!             name1, name2, value = match.group(1, 2, 3)
!             if name1 == 'album':
!                 if name2 == 'artist':
!                     self.artist = value
!                 elif name2 == 'title':
!                     self.title = value
!                 elif name2 == 'toc':
!                     if not self.toc:
!                         self.toc = value
!                     if self.toc != value:
!                         print 'toc\'s don\'t match'
!                 elif name2 == 'notes':
!                     self.notes.append(value)
!             elif name1[:5] == 'track':
!                 try:
!                     trackno = int(name1[5:])
!                 except ValueError:
!                     print 'syntax error in ' + file
!                     continue
!                 if trackno > ntracks:
!                     print 'track number %r in file %s out of range' % (trackno, file)
!                     continue
!                 if name2 == 'title':
!                     self.track[trackno] = value
!                 elif name2 == 'artist':
!                     self.trackartist[trackno] = value
!         f.close()
!         for i in range(2, len(self.track)):
!             track = self.track[i]
!             # if track title starts with `,', use initial part
!             # of previous track's title
!             if track and track[0] == ',':
!                 try:
!                     off = self.track[i - 1].index(',')
!                 except ValueError:
!                     pass
!                 else:
!                     self.track[i] = self.track[i-1][:off] \
!                                     + track
  
!     def _get_id(self, tracklist):
!         # fill in self.id and self.toc.
!         # if the argument is a string ending in .rdb, the part
!         # upto the suffix is taken as the id.
!         if type(tracklist) == type(''):
!             if tracklist[-4:] == '.rdb':
!                 self.id = tracklist[:-4]
!                 self.toc = ''
!                 return
!             t = []
!             for i in range(2, len(tracklist), 4):
!                 t.append((None, \
!                           (int(tracklist[i:i+2]), \
!                            int(tracklist[i+2:i+4]))))
!             tracklist = t
!         ntracks = len(tracklist)
!         self.id = _dbid((ntracks >> 4) & 0xF) + _dbid(ntracks & 0xF)
!         if ntracks <= _DB_ID_NTRACKS:
!             nidtracks = ntracks
!         else:
!             nidtracks = _DB_ID_NTRACKS - 1
!             min = 0
!             sec = 0
!             for track in tracklist:
!                 start, length = track
!                 min = min + length[0]
!                 sec = sec + length[1]
!             min = min + sec / 60
!             sec = sec % 60
!             self.id = self.id + _dbid(min) + _dbid(sec)
!         for i in range(nidtracks):
!             start, length = tracklist[i]
!             self.id = self.id + _dbid(length[0]) + _dbid(length[1])
!         self.toc = string.zfill(ntracks, 2)
!         for track in tracklist:
!             start, length = track
!             self.toc = self.toc + string.zfill(length[0], 2) + \
!                       string.zfill(length[1], 2)
  
!     def write(self):
!         import posixpath
!         if os.environ.has_key('CDDB_WRITE_DIR'):
!             dir = os.environ['CDDB_WRITE_DIR']
!         else:
!             dir = os.environ['HOME'] + '/' + _cddbrc
!         file = dir + '/' + self.id + '.rdb'
!         if posixpath.exists(file):
!             # make backup copy
!             posix.rename(file, file + '~')
!         f = open(file, 'w')
!         f.write('album.title:\t' + self.title + '\n')
!         f.write('album.artist:\t' + self.artist + '\n')
!         f.write('album.toc:\t' + self.toc + '\n')
!         for note in self.notes:
!             f.write('album.notes:\t' + note + '\n')
!         prevpref = None
!         for i in range(1, len(self.track)):
!             if self.trackartist[i]:
!                 f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i]))
!             track = self.track[i]
!             try:
!                 off = track.index(',')
!             except ValueError:
!                 prevpref = None
!             else:
!                 if prevpref and track[:off] == prevpref:
!                     track = track[off:]
!                 else:
!                     prevpref = track[:off]
!             f.write('track%r.title:\t%s\n' % (i, track))
!         f.close()

Index: cdplayer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/cdplayer.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** cdplayer.py	12 Feb 2004 17:35:10 -0000	1.6
--- cdplayer.py	18 Jul 2004 06:14:45 -0000	1.7
***************
*** 18,88 ****
  
  class Cdplayer:
! 	def __init__(self, tracklist):
! 		import string
! 		self.artist = ''
! 		self.title = ''
! 		if type(tracklist) == type(''):
! 			t = []
! 			for i in range(2, len(tracklist), 4):
! 				t.append((None, \
! 					  (int(tracklist[i:i+2]), \
! 					   int(tracklist[i+2:i+4]))))
! 			tracklist = t
! 		self.track = [None] + [''] * len(tracklist)
! 		self.id = 'd' + string.zfill(len(tracklist), 2)
! 		for track in tracklist:
! 			start, length = track
! 			self.id = self.id + string.zfill(length[0], 2) + \
! 				  string.zfill(length[1], 2)
! 		try:
! 			import posix
! 			f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r')
! 		except IOError:
! 			return
! 		import re
! 		reg = re.compile(r'^([^:]*):\t(.*)')
! 		s = self.id + '.'
! 		l = len(s)
! 		while 1:
! 			line = f.readline()
! 			if line == '':
! 				break
! 			if line[:l] == s:
! 				line = line[l:]
! 				match = reg.match(line)
! 				if not match:
! 					print 'syntax error in ~/' + cdplayerrc
! 					continue
! 				name, value = match.group(1, 2)
! 				if name == 'title':
! 					self.title = value
! 				elif name == 'artist':
! 					self.artist = value
! 				elif name[:5] == 'track':
! 					trackno = int(name[6:])
! 					self.track[trackno] = value
! 		f.close()
  
! 	def write(self):
! 		import posix
! 		filename = posix.environ['HOME'] + '/' + cdplayerrc
! 		try:
! 			old = open(filename, 'r')
! 		except IOError:
! 			old = open('/dev/null', 'r')
! 		new = open(filename + '.new', 'w')
! 		s = self.id + '.'
! 		l = len(s)
! 		while 1:
! 			line = old.readline()
! 			if line == '':
! 				break
! 			if line[:l] != s:
! 				new.write(line)
! 		new.write(self.id + '.title:\t' + self.title + '\n')
! 		new.write(self.id + '.artist:\t' + self.artist + '\n')
! 		for i in range(1, len(self.track)):
! 			new.write('%s.track.%r:\t%s\n' % (i, track))
! 		old.close()
! 		new.close()
! 		posix.rename(filename + '.new', filename)
--- 18,88 ----
  
  class Cdplayer:
!     def __init__(self, tracklist):
!         import string
!         self.artist = ''
!         self.title = ''
!         if type(tracklist) == type(''):
!             t = []
!             for i in range(2, len(tracklist), 4):
!                 t.append((None, \
!                           (int(tracklist[i:i+2]), \
!                            int(tracklist[i+2:i+4]))))
!             tracklist = t
!         self.track = [None] + [''] * len(tracklist)
!         self.id = 'd' + string.zfill(len(tracklist), 2)
!         for track in tracklist:
!             start, length = track
!             self.id = self.id + string.zfill(length[0], 2) + \
!                       string.zfill(length[1], 2)
!         try:
!             import posix
!             f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r')
!         except IOError:
!             return
!         import re
!         reg = re.compile(r'^([^:]*):\t(.*)')
!         s = self.id + '.'
!         l = len(s)
!         while 1:
!             line = f.readline()
!             if line == '':
!                 break
!             if line[:l] == s:
!                 line = line[l:]
!                 match = reg.match(line)
!                 if not match:
!                     print 'syntax error in ~/' + cdplayerrc
!                     continue
!                 name, value = match.group(1, 2)
!                 if name == 'title':
!                     self.title = value
!                 elif name == 'artist':
!                     self.artist = value
!                 elif name[:5] == 'track':
!                     trackno = int(name[6:])
!                     self.track[trackno] = value
!         f.close()
  
!     def write(self):
!         import posix
!         filename = posix.environ['HOME'] + '/' + cdplayerrc
!         try:
!             old = open(filename, 'r')
!         except IOError:
!             old = open('/dev/null', 'r')
!         new = open(filename + '.new', 'w')
!         s = self.id + '.'
!         l = len(s)
!         while 1:
!             line = old.readline()
!             if line == '':
!                 break
!             if line[:l] != s:
!                 new.write(line)
!         new.write(self.id + '.title:\t' + self.title + '\n')
!         new.write(self.id + '.artist:\t' + self.artist + '\n')
!         for i in range(1, len(self.track)):
!             new.write('%s.track.%r:\t%s\n' % (i, track))
!         old.close()
!         new.close()
!         posix.rename(filename + '.new', filename)

Index: flp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/flp.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** flp.py	12 Feb 2004 17:35:10 -0000	1.9
--- flp.py	18 Jul 2004 06:14:45 -0000	1.10
***************
*** 80,95 ****
  
  def _unpack_cache(altforms):
!         forms = {}
!         for name in altforms.keys():
!             altobj, altlist = altforms[name]
!             obj = _newobj()
!             obj.make(altobj)
!             list = []
!             for altobj in altlist:
!                 nobj = _newobj()
!                 nobj.make(altobj)
!                 list.append(nobj)
!             forms[name] = obj, list
!         return forms
  
  def rdlong(fp):
--- 80,95 ----
  
  def _unpack_cache(altforms):
!     forms = {}
!     for name in altforms.keys():
!         altobj, altlist = altforms[name]
!         obj = _newobj()
!         obj.make(altobj)
!         list = []
!         for altobj in altlist:
!             nobj = _newobj()
!             nobj.make(altobj)
!             list.append(nobj)
!         forms[name] = obj, list
!     return forms
  
  def rdlong(fp):
***************
*** 277,282 ****
      name, value = match.group(1, 2)
      if name[0] == 'N':
!             name = ''.join(name.split())
!             name = name.lower()
      name = name.capitalize()
      try:
--- 277,282 ----
      name, value = match.group(1, 2)
      if name[0] == 'N':
!         name = ''.join(name.split())
!         name = name.lower()
      name = name.capitalize()
      try:
***************
*** 292,296 ****
          raise EOFError
      return line[:-1]
!         
  def _parse_1_line(file):
      line = _readline(file)
--- 292,296 ----
          raise EOFError
      return line[:-1]
! 
  def _parse_1_line(file):
      line = _readline(file)

Index: jpeg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/jpeg.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** jpeg.py	12 Dec 2000 23:11:42 -0000	1.4
--- jpeg.py	18 Jul 2004 06:14:45 -0000	1.5
***************
*** 7,11 ****
  
  class error(Exception):
! 	pass
  
  options = {'quality': 75, 'optimize': 0, 'smooth': 0, 'forcegray': 0}
--- 7,11 ----
  
  class error(Exception):
!     pass
  
  options = {'quality': 75, 'optimize': 0, 'smooth': 0, 'forcegray': 0}
***************
*** 15,111 ****
  
  def compress(imgdata, width, height, bytesperpixel):
! 	global comp
! 	import cl
! 	if comp is None: comp = cl.OpenCompressor(cl.JPEG)
! 	if bytesperpixel == 1:
! 		format = cl.GRAYSCALE
! 	elif bytesperpixel == 4:
! 		format = cl.RGBX
! 	if options['forcegray']:
! 		iformat = cl.GRAYSCALE
! 	else:
! 		iformat = cl.YUV
! 	# XXX How to support 'optimize'?
! 	params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height,
! 		  cl.ORIGINAL_FORMAT, format,
! 		  cl.ORIENTATION, cl.BOTTOM_UP,
! 		  cl.QUALITY_FACTOR, options['quality'],
! 		  cl.INTERNAL_FORMAT, iformat,
! 		 ]
! 	comp.SetParams(params)
! 	jpegdata = comp.Compress(1, imgdata)
! 	return jpegdata
  
  def decompress(jpegdata):
! 	global decomp
! 	import cl
! 	if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG)
! 	headersize = decomp.ReadHeader(jpegdata)
! 	params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0]
! 	decomp.GetParams(params)
! 	width, height, format = params[1], params[3], params[5]
! 	if format == cl.GRAYSCALE or options['forcegray']:
! 		format = cl.GRAYSCALE
! 		bytesperpixel = 1
! 	else:
! 		format = cl.RGBX
! 		bytesperpixel = 4
! 	# XXX How to support 'smooth'?
! 	params = [cl.ORIGINAL_FORMAT, format,
! 		  cl.ORIENTATION, cl.BOTTOM_UP,
! 		  cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel]
! 	decomp.SetParams(params)
! 	imgdata = decomp.Decompress(1, jpegdata)
! 	return imgdata, width, height, bytesperpixel
  
  def setoption(name, value):
! 	if type(value) is not type(0):
! 		raise TypeError, 'jpeg.setoption: numeric options only'
! 	if name == 'forcegrey':
! 		name = 'forcegray'
! 	if not options.has_key(name):
! 		raise KeyError, 'jpeg.setoption: unknown option name'
! 	options[name] = int(value)
  
  def test():
! 	import sys
! 	if sys.argv[1:2] == ['-g']:
! 		del sys.argv[1]
! 		setoption('forcegray', 1)
! 	if not sys.argv[1:]:
! 		sys.argv.append('/usr/local/images/data/jpg/asterix.jpg')
! 	for file in sys.argv[1:]:
! 		show(file)
  
  def show(file):
! 	import gl, GL, DEVICE
! 	jpegdata = open(file, 'r').read()
! 	imgdata, width, height, bytesperpixel = decompress(jpegdata)
! 	gl.foreground()
! 	gl.prefsize(width, height)
! 	win = gl.winopen(file)
! 	if bytesperpixel == 1:
! 		gl.cmode()
! 		gl.pixmode(GL.PM_SIZE, 8)
! 		gl.gconfig()
! 		for i in range(256):
! 			gl.mapcolor(i, i, i, i)
! 	else:
! 		gl.RGBmode()
! 		gl.pixmode(GL.PM_SIZE, 32)
! 		gl.gconfig()
! 	gl.qdevice(DEVICE.REDRAW)
! 	gl.qdevice(DEVICE.ESCKEY)
! 	gl.qdevice(DEVICE.WINQUIT)
! 	gl.qdevice(DEVICE.WINSHUT)
! 	gl.lrectwrite(0, 0, width-1, height-1, imgdata)
! 	while 1:
! 		dev, val = gl.qread()
! 		if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT):
! 			break
! 		if dev == DEVICE.REDRAW:
! 			gl.lrectwrite(0, 0, width-1, height-1, imgdata)
! 	gl.winclose(win)
! 	# Now test the compression and write the result to a fixed filename
! 	newjpegdata = compress(imgdata, width, height, bytesperpixel)
! 	open('/tmp/j.jpg', 'w').write(newjpegdata)
--- 15,111 ----
  
  def compress(imgdata, width, height, bytesperpixel):
!     global comp
!     import cl
!     if comp is None: comp = cl.OpenCompressor(cl.JPEG)
!     if bytesperpixel == 1:
!         format = cl.GRAYSCALE
!     elif bytesperpixel == 4:
!         format = cl.RGBX
!     if options['forcegray']:
!         iformat = cl.GRAYSCALE
!     else:
!         iformat = cl.YUV
!     # XXX How to support 'optimize'?
!     params = [cl.IMAGE_WIDTH, width, cl.IMAGE_HEIGHT, height,
!               cl.ORIGINAL_FORMAT, format,
!               cl.ORIENTATION, cl.BOTTOM_UP,
!               cl.QUALITY_FACTOR, options['quality'],
!               cl.INTERNAL_FORMAT, iformat,
!              ]
!     comp.SetParams(params)
!     jpegdata = comp.Compress(1, imgdata)
!     return jpegdata
  
  def decompress(jpegdata):
!     global decomp
!     import cl
!     if decomp is None: decomp = cl.OpenDecompressor(cl.JPEG)
!     headersize = decomp.ReadHeader(jpegdata)
!     params = [cl.IMAGE_WIDTH, 0, cl.IMAGE_HEIGHT, 0, cl.INTERNAL_FORMAT, 0]
!     decomp.GetParams(params)
!     width, height, format = params[1], params[3], params[5]
!     if format == cl.GRAYSCALE or options['forcegray']:
!         format = cl.GRAYSCALE
!         bytesperpixel = 1
!     else:
!         format = cl.RGBX
!         bytesperpixel = 4
!     # XXX How to support 'smooth'?
!     params = [cl.ORIGINAL_FORMAT, format,
!               cl.ORIENTATION, cl.BOTTOM_UP,
!               cl.FRAME_BUFFER_SIZE, width*height*bytesperpixel]
!     decomp.SetParams(params)
!     imgdata = decomp.Decompress(1, jpegdata)
!     return imgdata, width, height, bytesperpixel
  
  def setoption(name, value):
!     if type(value) is not type(0):
!         raise TypeError, 'jpeg.setoption: numeric options only'
!     if name == 'forcegrey':
!         name = 'forcegray'
!     if not options.has_key(name):
!         raise KeyError, 'jpeg.setoption: unknown option name'
!     options[name] = int(value)
  
  def test():
!     import sys
!     if sys.argv[1:2] == ['-g']:
!         del sys.argv[1]
!         setoption('forcegray', 1)
!     if not sys.argv[1:]:
!         sys.argv.append('/usr/local/images/data/jpg/asterix.jpg')
!     for file in sys.argv[1:]:
!         show(file)
  
  def show(file):
!     import gl, GL, DEVICE
!     jpegdata = open(file, 'r').read()
!     imgdata, width, height, bytesperpixel = decompress(jpegdata)
!     gl.foreground()
!     gl.prefsize(width, height)
!     win = gl.winopen(file)
!     if bytesperpixel == 1:
!         gl.cmode()
!         gl.pixmode(GL.PM_SIZE, 8)
!         gl.gconfig()
!         for i in range(256):
!             gl.mapcolor(i, i, i, i)
!     else:
!         gl.RGBmode()
!         gl.pixmode(GL.PM_SIZE, 32)
!         gl.gconfig()
!     gl.qdevice(DEVICE.REDRAW)
!     gl.qdevice(DEVICE.ESCKEY)
!     gl.qdevice(DEVICE.WINQUIT)
!     gl.qdevice(DEVICE.WINSHUT)
!     gl.lrectwrite(0, 0, width-1, height-1, imgdata)
!     while 1:
!         dev, val = gl.qread()
!         if dev in (DEVICE.ESCKEY, DEVICE.WINSHUT, DEVICE.WINQUIT):
!             break
!         if dev == DEVICE.REDRAW:
!             gl.lrectwrite(0, 0, width-1, height-1, imgdata)
!     gl.winclose(win)
!     # Now test the compression and write the result to a fixed filename
!     newjpegdata = compress(imgdata, width, height, bytesperpixel)
!     open('/tmp/j.jpg', 'w').write(newjpegdata)

Index: panel.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/panel.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** panel.py	12 Feb 2004 17:35:10 -0000	1.4
--- panel.py	18 Jul 2004 06:14:45 -0000	1.5
***************
*** 18,22 ****
  #
  def is_list(x):
! 	return type(x) == type([])
  
  
--- 18,22 ----
  #
  def is_list(x):
!     return type(x) == type([])
  
  
***************
*** 24,31 ****
  #
  def reverse(list):
! 	res = []
! 	for item in list:
! 		res.insert(0, item)
! 	return res
  
  
--- 24,31 ----
  #
  def reverse(list):
!     res = []
!     for item in list:
!         res.insert(0, item)
!     return res
  
  
***************
*** 34,41 ****
  #
  def getattrlist(list, name):
! 	for item in list:
! 		if item and is_list(item) and item[0] == name:
! 			return item[1:]
! 	return []
  
  
--- 34,41 ----
  #
  def getattrlist(list, name):
!     for item in list:
!         if item and is_list(item) and item[0] == name:
!             return item[1:]
!     return []
  
  
***************
*** 43,51 ****
  #
  def getproplist(list, name):
! 	for item in list:
! 		if item and is_list(item) and item[0] == 'prop':
! 			if len(item) > 1 and item[1] == name:
! 				return item[2:]
! 	return []
  
  
--- 43,51 ----
  #
  def getproplist(list, name):
!     for item in list:
!         if item and is_list(item) and item[0] == 'prop':
!             if len(item) > 1 and item[1] == name:
!                 return item[2:]
!     return []
  
  
***************
*** 53,58 ****
  #
  def is_endgroup(list):
! 	x = getproplist(list, 'end-of-group')
! 	return (x and x[0] == '#t')
  
  
--- 53,58 ----
  #
  def is_endgroup(list):
!     x = getproplist(list, 'end-of-group')
!     return (x and x[0] == '#t')
  
  
***************
*** 61,78 ****
  #
  def show_actuator(prefix, a):
! 	for item in a:
! 		if not is_list(item):
! 			print prefix, item
! 		elif item and item[0] == 'al':
! 			print prefix, 'Subactuator list:'
! 			for a in item[1:]:
! 				show_actuator(prefix + '    ', a)
! 		elif len(item) == 2:
! 			print prefix, item[0], '=>', item[1]
! 		elif len(item) == 3 and item[0] == 'prop':
! 			print prefix, 'Prop', item[1], '=>',
! 			print item[2]
! 		else:
! 			print prefix, '?', item
  
  
--- 61,78 ----
  #
  def show_actuator(prefix, a):
!     for item in a:
!         if not is_list(item):
!             print prefix, item
!         elif item and item[0] == 'al':
!             print prefix, 'Subactuator list:'
!             for a in item[1:]:
!                 show_actuator(prefix + '    ', a)
!         elif len(item) == 2:
!             print prefix, item[0], '=>', item[1]
!         elif len(item) == 3 and item[0] == 'prop':
!             print prefix, 'Prop', item[1], '=>',
!             print item[2]
!         else:
!             print prefix, '?', item
  
  
***************
*** 80,97 ****
  #
  def show_panel(prefix, p):
! 	for item in p:
! 		if not is_list(item):
! 			print prefix, item
! 		elif item and item[0] == 'al':
! 			print prefix, 'Actuator list:'
! 			for a in item[1:]:
! 				show_actuator(prefix + '    ', a)
! 		elif len(item) == 2:
! 			print prefix, item[0], '=>', item[1]
! 		elif len(item) == 3 and item[0] == 'prop':
! 			print prefix, 'Prop', item[1], '=>',
! 			print item[2]
! 		else:
! 			print prefix, '?', item
  
  
--- 80,97 ----
  #
  def show_panel(prefix, p):
!     for item in p:
!         if not is_list(item):
!             print prefix, item
!         elif item and item[0] == 'al':
!             print prefix, 'Actuator list:'
!             for a in item[1:]:
!                 show_actuator(prefix + '    ', a)
!         elif len(item) == 2:
!             print prefix, item[0], '=>', item[1]
!         elif len(item) == 3 and item[0] == 'prop':
!             print prefix, 'Prop', item[1], '=>',
!             print item[2]
!         else:
!             print prefix, '?', item
  
  
***************
*** 104,108 ****
  #
  def dummy_callback(arg):
! 	pass
  
  
--- 104,108 ----
  #
  def dummy_callback(arg):
!     pass
  
  
***************
*** 112,139 ****
  #
  def assign_members(target, attrlist, exclist, prefix):
! 	for item in attrlist:
! 		if is_list(item) and len(item) == 2 and item[0] not in exclist:
! 			name, value = item[0], item[1]
! 			ok = 1
! 			if value[0] in '-0123456789':
! 				value = eval(value)
! 			elif value[0] == '"':
! 				value = value[1:-1]
! 			elif value == 'move-then-resize':
! 				# Strange default set by Panel Editor...
! 				ok = 0
! 			else:
! 				print 'unknown value', value, 'for', name
! 				ok = 0
! 			if ok:
! 				lhs = 'target.' + prefix + name
! 				stmt = lhs + '=' + repr(value)
! 				if debug: print 'exec', stmt
! 				try:
! 					exec stmt + '\n'
! 				except KeyboardInterrupt: # Don't catch this!
! 					raise KeyboardInterrupt
! 				except:
! 					print 'assign failed:', stmt
  
  
--- 112,139 ----
  #
  def assign_members(target, attrlist, exclist, prefix):
!     for item in attrlist:
!         if is_list(item) and len(item) == 2 and item[0] not in exclist:
!             name, value = item[0], item[1]
!             ok = 1
!             if value[0] in '-0123456789':
!                 value = eval(value)
!             elif value[0] == '"':
!                 value = value[1:-1]
!             elif value == 'move-then-resize':
!                 # Strange default set by Panel Editor...
!                 ok = 0
!             else:
!                 print 'unknown value', value, 'for', name
!                 ok = 0
!             if ok:
!                 lhs = 'target.' + prefix + name
!                 stmt = lhs + '=' + repr(value)
!                 if debug: print 'exec', stmt
!                 try:
!                     exec stmt + '\n'
!                 except KeyboardInterrupt: # Don't catch this!
!                     raise KeyboardInterrupt
!                 except:
!                     print 'assign failed:', stmt
  
  
***************
*** 142,169 ****
  #
  def build_actuator(descr):
! 	namelist = getattrlist(descr, 'name')
! 	if namelist:
! 		# Assume it is a string
! 		actuatorname = namelist[0][1:-1]
! 	else:
! 		actuatorname = ''
! 	type = descr[0]
! 	if type[:4] == 'pnl_': type = type[4:]
! 	act = pnl.mkact(type)
! 	act.downfunc = act.activefunc = act.upfunc = dummy_callback
! 	#
! 	assign_members(act, descr[1:], ['al', 'data', 'name'], '')
! 	#
! 	# Treat actuator-specific data
! 	#
! 	datalist = getattrlist(descr, 'data')
! 	prefix = ''
! 	if type[-4:] == 'puck':
! 		prefix = 'puck_'
! 	elif type == 'mouse':
! 		prefix = 'mouse_'
! 	assign_members(act, datalist, [], prefix)
! 	#
! 	return act, actuatorname
  
  
--- 142,169 ----
  #
  def build_actuator(descr):
!     namelist = getattrlist(descr, 'name')
!     if namelist:
!         # Assume it is a string
!         actuatorname = namelist[0][1:-1]
!     else:
!         actuatorname = ''
!     type = descr[0]
!     if type[:4] == 'pnl_': type = type[4:]
!     act = pnl.mkact(type)
!     act.downfunc = act.activefunc = act.upfunc = dummy_callback
!     #
!     assign_members(act, descr[1:], ['al', 'data', 'name'], '')
!     #
!     # Treat actuator-specific data
!     #
!     datalist = getattrlist(descr, 'data')
!     prefix = ''
!     if type[-4:] == 'puck':
!         prefix = 'puck_'
!     elif type == 'mouse':
!         prefix = 'mouse_'
!     assign_members(act, datalist, [], prefix)
!     #
!     return act, actuatorname
  
  
***************
*** 177,201 ****
  #
  def build_subactuators(panel, super_act, al):
! 	#
! 	# This is nearly the same loop as below in build_panel(),
! 	# except a call is made to addsubact() instead of addact().
! 	#
! 	for a in al:
! 		act, name = build_actuator(a)
! 		act.addsubact(super_act)
! 		if name:
! 			stmt = 'panel.' + name + ' = act'
! 			if debug: print 'exec', stmt
! 			exec stmt + '\n'
! 		if is_endgroup(a):
! 			panel.endgroup()
! 		sub_al = getattrlist(a, 'al')
! 		if sub_al:
! 			build_subactuators(panel, act, sub_al)
! 	#
! 	# Fix the actuator to which whe just added subactuators.
! 	# This can't hurt (I hope) and is needed for the scroll actuator.
! 	#
! 	super_act.fixact()
  
  
--- 177,201 ----
  #
  def build_subactuators(panel, super_act, al):
!     #
!     # This is nearly the same loop as below in build_panel(),
!     # except a call is made to addsubact() instead of addact().
!     #
!     for a in al:
!         act, name = build_actuator(a)
!         act.addsubact(super_act)
!         if name:
!             stmt = 'panel.' + name + ' = act'
!             if debug: print 'exec', stmt
!             exec stmt + '\n'
!         if is_endgroup(a):
!             panel.endgroup()
!         sub_al = getattrlist(a, 'al')
!         if sub_al:
!             build_subactuators(panel, act, sub_al)
!     #
!     # Fix the actuator to which whe just added subactuators.
!     # This can't hurt (I hope) and is needed for the scroll actuator.
!     #
!     super_act.fixact()
  
  
***************
*** 205,248 ****
  #
  def build_panel(descr):
! 	#
! 	# Sanity check
! 	#
! 	if (not descr) or descr[0] != 'panel':
! 		raise panel_error, 'panel description must start with "panel"'
! 	#
! 	if debug: show_panel('', descr)
! 	#
! 	# Create an empty panel
! 	#
! 	panel = pnl.mkpanel()
! 	#
! 	# Assign panel attributes
! 	#
! 	assign_members(panel, descr[1:], ['al'], '')
! 	#
! 	# Look for actuator list
! 	#
! 	al = getattrlist(descr, 'al')
! 	#
! 	# The order in which actuators are created is important
! 	# because of the endgroup() operator.
! 	# Unfortunately the Panel Editor outputs the actuator list
! 	# in reverse order, so we reverse it here.
! 	#
! 	al = reverse(al)
! 	#
! 	for a in al:
! 		act, name = build_actuator(a)
! 		act.addact(panel)
! 		if name:
! 			stmt = 'panel.' + name + ' = act'
! 			exec stmt + '\n'
! 		if is_endgroup(a):
! 			panel.endgroup()
! 		sub_al = getattrlist(a, 'al')
! 		if sub_al:
! 			build_subactuators(panel, act, sub_al)
! 	#
! 	return panel
  
  
--- 205,248 ----
  #
  def build_panel(descr):
!     #
!     # Sanity check
!     #
!     if (not descr) or descr[0] != 'panel':
!         raise panel_error, 'panel description must start with "panel"'
!     #
!     if debug: show_panel('', descr)
!     #
!     # Create an empty panel
!     #
!     panel = pnl.mkpanel()
!     #
!     # Assign panel attributes
!     #
!     assign_members(panel, descr[1:], ['al'], '')
!     #
!     # Look for actuator list
!     #
!     al = getattrlist(descr, 'al')
!     #
!     # The order in which actuators are created is important
!     # because of the endgroup() operator.
!     # Unfortunately the Panel Editor outputs the actuator list
!     # in reverse order, so we reverse it here.
!     #
!     al = reverse(al)
!     #
!     for a in al:
!         act, name = build_actuator(a)
!         act.addact(panel)
!         if name:
!             stmt = 'panel.' + name + ' = act'
!             exec stmt + '\n'
!         if is_endgroup(a):
!             panel.endgroup()
!         sub_al = getattrlist(a, 'al')
!         if sub_al:
!             build_subactuators(panel, act, sub_al)
!     #
!     return panel
  
  
***************
*** 250,274 ****
  #
  def my_dopanel():
! 	# Extract only the first 4 elements to allow for future expansion
! 	a, down, active, up = pnl.dopanel()[:4]
! 	if down:
! 		down.downfunc(down)
! 	if active:
! 		active.activefunc(active)
! 	if up:
! 		up.upfunc(up)
! 	return a
  
  
  # Create one or more panels from a description file (S-expressions)
  # generated by the Panel Editor.
! # 
  def defpanellist(file):
! 	import panelparser
! 	descrlist = panelparser.parse_file(open(file, 'r'))
! 	panellist = []
! 	for descr in descrlist:
! 		panellist.append(build_panel(descr))
! 	return panellist
  
  
--- 250,274 ----
  #
  def my_dopanel():
!     # Extract only the first 4 elements to allow for future expansion
!     a, down, active, up = pnl.dopanel()[:4]
!     if down:
!         down.downfunc(down)
!     if active:
!         active.activefunc(active)
!     if up:
!         up.upfunc(up)
!     return a
  
  
  # Create one or more panels from a description file (S-expressions)
  # generated by the Panel Editor.
! #
  def defpanellist(file):
!     import panelparser
!     descrlist = panelparser.parse_file(open(file, 'r'))
!     panellist = []
!     for descr in descrlist:
!         panellist.append(build_panel(descr))
!     return panellist
  
  
***************
*** 277,281 ****
  # This gives *no* performance penalty once this module is imported.
  #
! from pnl import *			# for export
  
! dopanel = my_dopanel			# override pnl.dopanel
--- 277,281 ----
  # This gives *no* performance penalty once this module is imported.
  #
! from pnl import *                       # for export
  
! dopanel = my_dopanel                    # override pnl.dopanel

Index: panelparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/panelparser.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** panelparser.py	12 Dec 2000 23:11:42 -0000	1.2
--- panelparser.py	18 Jul 2004 06:14:45 -0000	1.3
***************
*** 16,48 ****
  #
  def tokenize_string(s):
! 	tokens = []
! 	while s:
! 		c = s[:1]
! 		if c in whitespace:
! 			s = s[1:]
! 		elif c == ';':
! 			s = ''
! 		elif c == '"':
! 			n = len(s)
! 			i = 1
! 			while i < n:
! 				c = s[i]
! 				i = i+1
! 				if c == '"': break
! 				if c == '\\': i = i+1
! 			tokens.append(s[:i])
! 			s = s[i:]
! 		elif c in operators:
! 			tokens.append(c)
! 			s = s[1:]
! 		else:
! 			n = len(s)
! 			i = 1
! 			while i < n:
! 				if s[i] in separators: break
! 				i = i+1
! 			tokens.append(s[:i])
! 			s = s[i:]
! 	return tokens
  
  
--- 16,48 ----
  #
  def tokenize_string(s):
!     tokens = []
!     while s:
!         c = s[:1]
!         if c in whitespace:
!             s = s[1:]
!         elif c == ';':
!             s = ''
!         elif c == '"':
!             n = len(s)
!             i = 1
!             while i < n:
!                 c = s[i]
!                 i = i+1
!                 if c == '"': break
!                 if c == '\\': i = i+1
!             tokens.append(s[:i])
!             s = s[i:]
!         elif c in operators:
!             tokens.append(c)
!             s = s[1:]
!         else:
!             n = len(s)
!             i = 1
!             while i < n:
!                 if s[i] in separators: break
!                 i = i+1
!             tokens.append(s[:i])
!             s = s[i:]
!     return tokens
  
  
***************
*** 51,60 ****
  #
  def tokenize_file(fp):
! 	tokens = []
! 	while 1:
! 		line = fp.readline()
! 		if not line: break
! 		tokens = tokens + tokenize_string(line)
! 	return tokens
  
  
--- 51,60 ----
  #
  def tokenize_file(fp):
!     tokens = []
!     while 1:
!         line = fp.readline()
!         if not line: break
!         tokens = tokens + tokenize_string(line)
!     return tokens
  
  
***************
*** 72,90 ****
  #
  def parse_expr(tokens):
! 	if (not tokens) or tokens[0] != '(':
! 		raise syntax_error, 'expected "("'
! 	tokens = tokens[1:]
! 	expr = []
! 	while 1:
! 		if not tokens:
! 			raise syntax_error, 'missing ")"'
! 		if tokens[0] == ')':
! 			return expr, tokens[1:]
! 		elif tokens[0] == '(':
! 			subexpr, tokens = parse_expr(tokens)
! 			expr.append(subexpr)
! 		else:
! 			expr.append(tokens[0])
! 			tokens = tokens[1:]
  
  
--- 72,90 ----
  #
  def parse_expr(tokens):
!     if (not tokens) or tokens[0] != '(':
!         raise syntax_error, 'expected "("'
!     tokens = tokens[1:]
!     expr = []
!     while 1:
!         if not tokens:
!             raise syntax_error, 'missing ")"'
!         if tokens[0] == ')':
!             return expr, tokens[1:]
!         elif tokens[0] == '(':
!             subexpr, tokens = parse_expr(tokens)
!             expr.append(subexpr)
!         else:
!             expr.append(tokens[0])
!             tokens = tokens[1:]
  
  
***************
*** 93,102 ****
  #
  def parse_file(fp):
! 	tokens = tokenize_file(fp)
! 	exprlist = []
! 	while tokens:
! 		expr, tokens = parse_expr(tokens)
! 		exprlist.append(expr)
! 	return exprlist
  
  
--- 93,102 ----
  #
  def parse_file(fp):
!     tokens = tokenize_file(fp)
!     exprlist = []
!     while tokens:
!         expr, tokens = parse_expr(tokens)
!         exprlist.append(expr)
!     return exprlist
  
  
***************
*** 104,119 ****
  #
  # The input
! #	'(hip (hop hur-ray))'
  #
  # passed to tokenize_string() returns the token list
! #	['(', 'hip', '(', 'hop', 'hur-ray', ')', ')']
  #
  # When this is passed to parse_expr() it returns the expression
! #	['hip', ['hop', 'hur-ray']]
  # plus an empty token list (because there are no tokens left.
  #
  # When a file containing the example is passed to parse_file() it returns
  # a list whose only element is the output of parse_expr() above:
! #	[['hip', ['hop', 'hur-ray']]]
  
  
--- 104,119 ----
  #
  # The input
! #       '(hip (hop hur-ray))'
  #
  # passed to tokenize_string() returns the token list
! #       ['(', 'hip', '(', 'hop', 'hur-ray', ')', ')']
  #
  # When this is passed to parse_expr() it returns the expression
! #       ['hip', ['hop', 'hur-ray']]
  # plus an empty token list (because there are no tokens left.
  #
  # When a file containing the example is passed to parse_file() it returns
  # a list whose only element is the output of parse_expr() above:
! #       [['hip', ['hop', 'hur-ray']]]
  
  
***************
*** 124,128 ****
  # Tokens are separated by whitespace, except the following characters
  # always form a separate token (outside strings):
! #	( ) '
  # Strings are enclosed in double quotes (") and backslash (\) is used
  # as escape character in strings.
--- 124,128 ----
  # Tokens are separated by whitespace, except the following characters
  # always form a separate token (outside strings):
! #       ( ) '
  # Strings are enclosed in double quotes (") and backslash (\) is used
  # as escape character in strings.

Index: readcd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/readcd.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** readcd.py	12 Feb 2004 17:35:10 -0000	1.4
--- readcd.py	18 Jul 2004 06:14:45 -0000	1.5
***************
*** 4,244 ****
  
  class Error(Exception):
! 	pass
  class _Stop(Exception):
! 	pass
  
  def _doatime(self, cb_type, data):
! 	if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
! ##		print 'done with list entry', repr(self.listindex)
! 		raise _Stop
! 	func, arg = self.callbacks[cb_type]
! 	if func:
! 		func(arg, cb_type, data)
  
  def _dopnum(self, cb_type, data):
! 	if data > self.end:
! ##		print 'done with list entry', repr(self.listindex)
! 		raise _Stop
! 	func, arg = self.callbacks[cb_type]
! 	if func:
! 		func(arg, cb_type, data)
  
  class Readcd:
! 	def __init__(self, *arg):
! 		if len(arg) == 0:
! 			self.player = cd.open()
! 		elif len(arg) == 1:
! 			self.player = cd.open(arg[0])
! 		elif len(arg) == 2:
! 			self.player = cd.open(arg[0], arg[1])
! 		else:
! 			raise Error, 'bad __init__ call'
! 		self.list = []
! 		self.callbacks = [(None, None)] * 8
! 		self.parser = cd.createparser()
! 		self.playing = 0
! 		self.end = 0
! 		self.status = None
! 		self.trackinfo = None
  
! 	def eject(self):
! 		self.player.eject()
! 		self.list = []
! 		self.end = 0
! 		self.listindex = 0
! 		self.status = None
! 		self.trackinfo = None
! 		if self.playing:
! ##			print 'stop playing from eject'
! 			raise _Stop
  
! 	def pmsf2msf(self, track, min, sec, frame):
! 		if not self.status:
! 			self.cachestatus()
! 		if track < self.status[5] or track > self.status[6]:
! 			raise Error, 'track number out of range'
! 		if not self.trackinfo:
! 			self.cacheinfo()
! 		start, total = self.trackinfo[track]
! 		start = ((start[0] * 60) + start[1]) * 75 + start[2]
! 		total = ((total[0] * 60) + total[1]) * 75 + total[2]
! 		block = ((min * 60) + sec) * 75 + frame
! 		if block > total:
! 			raise Error, 'out of range'
! 		block = start + block
! 		min, block = divmod(block, 75*60)
! 		sec, frame = divmod(block, 75)
! 		return min, sec, frame
  
! 	def reset(self):
! 		self.list = []
  
! 	def appendtrack(self, track):
! 		self.appendstretch(track, track)
! 				
! 	def appendstretch(self, start, end):
! 		if not self.status:
! 			self.cachestatus()
! 		if not start:
! 			start = 1
! 		if not end:
! 			end = self.status[6]
! 		if type(end) == type(0):
! 			if end < self.status[5] or end > self.status[6]:
! 				raise Error, 'range error'
! 		else:
! 			l = len(end)
! 			if l == 4:
! 				prog, min, sec, frame = end
! 				if prog < self.status[5] or prog > self.status[6]:
! 					raise Error, 'range error'
! 				end = self.pmsf2msf(prog, min, sec, frame)
! 			elif l != 3:
! 				raise Error, 'syntax error'
! 		if type(start) == type(0):
! 			if start < self.status[5] or start > self.status[6]:
! 				raise Error, 'range error'
! 			if len(self.list) > 0:
! 				s, e = self.list[-1]
! 				if type(e) == type(0):
! 					if start == e+1:
! 						start = s
! 						del self.list[-1]
! 		else:
! 			l = len(start)
! 			if l == 4:
! 				prog, min, sec, frame = start
! 				if prog < self.status[5] or prog > self.status[6]:
! 					raise Error, 'range error'
! 				start = self.pmsf2msf(prog, min, sec, frame)
! 			elif l != 3:
! 				raise Error, 'syntax error'
! 		self.list.append((start, end))
  
! 	def settracks(self, list):
! 		self.list = []
! 		for track in list:
! 			self.appendtrack(track)
  
! 	def setcallback(self, cb_type, func, arg):
! 		if cb_type < 0 or cb_type >= 8:
! 			raise Error, 'type out of range'
! 		self.callbacks[cb_type] = (func, arg)
! 		if self.playing:
! 			start, end = self.list[self.listindex]
! 			if type(end) == type(0):
! 				if cb_type != CD.PNUM:
! 					self.parser.setcallback(cb_type, func, arg)
! 			else:
! 				if cb_type != CD.ATIME:
! 					self.parser.setcallback(cb_type, func, arg)
  
! 	def removecallback(self, cb_type):
! 		if cb_type < 0 or cb_type >= 8:
! 			raise Error, 'type out of range'
! 		self.callbacks[cb_type] = (None, None)
! 		if self.playing:
! 			start, end = self.list[self.listindex]
! 			if type(end) == type(0):
! 				if cb_type != CD.PNUM:
! 					self.parser.removecallback(cb_type)
! 			else:
! 				if cb_type != CD.ATIME:
! 					self.parser.removecallback(cb_type)
  
! 	def gettrackinfo(self, *arg):
! 		if not self.status:
! 			self.cachestatus()
! 		if not self.trackinfo:
! 			self.cacheinfo()
! 		if len(arg) == 0:
! 			return self.trackinfo[self.status[5]:self.status[6]+1]
! 		result = []
! 		for i in arg:
! 			if i < self.status[5] or i > self.status[6]:
! 				raise Error, 'range error'
! 			result.append(self.trackinfo[i])
! 		return result
  
! 	def cacheinfo(self):
! 		if not self.status:
! 			self.cachestatus()
! 		self.trackinfo = []
! 		for i in range(self.status[5]):
! 			self.trackinfo.append(None)
! 		for i in range(self.status[5], self.status[6]+1):
! 			self.trackinfo.append(self.player.gettrackinfo(i))
  
! 	def cachestatus(self):
! 		self.status = self.player.getstatus()
! 		if self.status[0] == CD.NODISC:
! 			self.status = None
! 			raise Error, 'no disc in player'
  
! 	def getstatus(self):
! 		return self.player.getstatus()
  
! 	def play(self):
! 		if not self.status:
! 			self.cachestatus()
! 		size = self.player.bestreadsize()
! 		self.listindex = 0
! 		self.playing = 0
! 		for i in range(8):
! 			func, arg = self.callbacks[i]
! 			if func:
! 				self.parser.setcallback(i, func, arg)
! 			else:
! 				self.parser.removecallback(i)
! 		if len(self.list) == 0:
! 			for i in range(self.status[5], self.status[6]+1):
! 				self.appendtrack(i)
! 		try:
! 			while 1:
! 				if not self.playing:
! 					if self.listindex >= len(self.list):
! 						return
! 					start, end = self.list[self.listindex]
! 					if type(start) == type(0):
! 						dummy = self.player.seektrack(
! 							start)
! 					else:
! 						min, sec, frame = start
! 						dummy = self.player.seek(
! 							min, sec, frame)
! 					if type(end) == type(0):
! 						self.parser.setcallback(
! 							CD.PNUM, _dopnum, self)
! 						self.end = end
! 						func, arg = \
! 						      self.callbacks[CD.ATIME]
! 						if func:
! 							self.parser.setcallback(CD.ATIME, func, arg)
! 						else:
! 							self.parser.removecallback(CD.ATIME)
! 					else:
! 						min, sec, frame = end
! 						self.parser.setcallback(
! 							CD.ATIME, _doatime,
! 							self)
! 						self.end = (min * 60 + sec) * \
! 							   75 + frame
! 						func, arg = \
! 						      self.callbacks[CD.PNUM]
! 						if func:
! 							self.parser.setcallback(CD.PNUM, func, arg)
! 						else:
! 							self.parser.removecallback(CD.PNUM)
! 					self.playing = 1
! 				data = self.player.readda(size)
! 				if data == '':
! 					self.playing = 0
! 					self.listindex = self.listindex + 1
! 					continue
! 				try:
! 					self.parser.parseframe(data)
! 				except _Stop:
! 					self.playing = 0
! 					self.listindex = self.listindex + 1
! 		finally:
! 			self.playing = 0
--- 4,244 ----
  
  class Error(Exception):
!     pass
  class _Stop(Exception):
!     pass
  
  def _doatime(self, cb_type, data):
!     if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
! ##              print 'done with list entry', repr(self.listindex)
!         raise _Stop
!     func, arg = self.callbacks[cb_type]
!     if func:
!         func(arg, cb_type, data)
  
  def _dopnum(self, cb_type, data):
!     if data > self.end:
! ##              print 'done with list entry', repr(self.listindex)
!         raise _Stop
!     func, arg = self.callbacks[cb_type]
!     if func:
!         func(arg, cb_type, data)
  
  class Readcd:
!     def __init__(self, *arg):
!         if len(arg) == 0:
!             self.player = cd.open()
!         elif len(arg) == 1:
!             self.player = cd.open(arg[0])
!         elif len(arg) == 2:
!             self.player = cd.open(arg[0], arg[1])
!         else:
!             raise Error, 'bad __init__ call'
!         self.list = []
!         self.callbacks = [(None, None)] * 8
!         self.parser = cd.createparser()
!         self.playing = 0
!         self.end = 0
!         self.status = None
!         self.trackinfo = None
  
!     def eject(self):
!         self.player.eject()
!         self.list = []
!         self.end = 0
!         self.listindex = 0
!         self.status = None
!         self.trackinfo = None
!         if self.playing:
! ##                      print 'stop playing from eject'
!             raise _Stop
  
!     def pmsf2msf(self, track, min, sec, frame):
!         if not self.status:
!             self.cachestatus()
!         if track < self.status[5] or track > self.status[6]:
!             raise Error, 'track number out of range'
!         if not self.trackinfo:
!             self.cacheinfo()
!         start, total = self.trackinfo[track]
!         start = ((start[0] * 60) + start[1]) * 75 + start[2]
!         total = ((total[0] * 60) + total[1]) * 75 + total[2]
!         block = ((min * 60) + sec) * 75 + frame
!         if block > total:
!             raise Error, 'out of range'
!         block = start + block
!         min, block = divmod(block, 75*60)
!         sec, frame = divmod(block, 75)
!         return min, sec, frame
  
!     def reset(self):
!         self.list = []
  
!     def appendtrack(self, track):
!         self.appendstretch(track, track)
  
!     def appendstretch(self, start, end):
!         if not self.status:
!             self.cachestatus()
!         if not start:
!             start = 1
!         if not end:
!             end = self.status[6]
!         if type(end) == type(0):
!             if end < self.status[5] or end > self.status[6]:
!                 raise Error, 'range error'
!         else:
!             l = len(end)
!             if l == 4:
!                 prog, min, sec, frame = end
!                 if prog < self.status[5] or prog > self.status[6]:
!                     raise Error, 'range error'
!                 end = self.pmsf2msf(prog, min, sec, frame)
!             elif l != 3:
!                 raise Error, 'syntax error'
!         if type(start) == type(0):
!             if start < self.status[5] or start > self.status[6]:
!                 raise Error, 'range error'
!             if len(self.list) > 0:
!                 s, e = self.list[-1]
!                 if type(e) == type(0):
!                     if start == e+1:
!                         start = s
!                         del self.list[-1]
!         else:
!             l = len(start)
!             if l == 4:
!                 prog, min, sec, frame = start
!                 if prog < self.status[5] or prog > self.status[6]:
!                     raise Error, 'range error'
!                 start = self.pmsf2msf(prog, min, sec, frame)
!             elif l != 3:
!                 raise Error, 'syntax error'
!         self.list.append((start, end))
  
!     def settracks(self, list):
!         self.list = []
!         for track in list:
!             self.appendtrack(track)
  
!     def setcallback(self, cb_type, func, arg):
!         if cb_type < 0 or cb_type >= 8:
!             raise Error, 'type out of range'
!         self.callbacks[cb_type] = (func, arg)
!         if self.playing:
!             start, end = self.list[self.listindex]
!             if type(end) == type(0):
!                 if cb_type != CD.PNUM:
!                     self.parser.setcallback(cb_type, func, arg)
!             else:
!                 if cb_type != CD.ATIME:
!                     self.parser.setcallback(cb_type, func, arg)
  
!     def removecallback(self, cb_type):
!         if cb_type < 0 or cb_type >= 8:
!             raise Error, 'type out of range'
!         self.callbacks[cb_type] = (None, None)
!         if self.playing:
!             start, end = self.list[self.listindex]
!             if type(end) == type(0):
!                 if cb_type != CD.PNUM:
!                     self.parser.removecallback(cb_type)
!             else:
!                 if cb_type != CD.ATIME:
!                     self.parser.removecallback(cb_type)
  
!     def gettrackinfo(self, *arg):
!         if not self.status:
!             self.cachestatus()
!         if not self.trackinfo:
!             self.cacheinfo()
!         if len(arg) == 0:
!             return self.trackinfo[self.status[5]:self.status[6]+1]
!         result = []
!         for i in arg:
!             if i < self.status[5] or i > self.status[6]:
!                 raise Error, 'range error'
!             result.append(self.trackinfo[i])
!         return result
  
!     def cacheinfo(self):
!         if not self.status:
!             self.cachestatus()
!         self.trackinfo = []
!         for i in range(self.status[5]):
!             self.trackinfo.append(None)
!         for i in range(self.status[5], self.status[6]+1):
!             self.trackinfo.append(self.player.gettrackinfo(i))
  
!     def cachestatus(self):
!         self.status = self.player.getstatus()
!         if self.status[0] == CD.NODISC:
!             self.status = None
!             raise Error, 'no disc in player'
  
!     def getstatus(self):
!         return self.player.getstatus()
! 
!     def play(self):
!         if not self.status:
!             self.cachestatus()
!         size = self.player.bestreadsize()
!         self.listindex = 0
!         self.playing = 0
!         for i in range(8):
!             func, arg = self.callbacks[i]
!             if func:
!                 self.parser.setcallback(i, func, arg)
!             else:
!                 self.parser.removecallback(i)
!         if len(self.list) == 0:
!             for i in range(self.status[5], self.status[6]+1):
!                 self.appendtrack(i)
!         try:
!             while 1:
!                 if not self.playing:
!                     if self.listindex >= len(self.list):
!                         return
!                     start, end = self.list[self.listindex]
!                     if type(start) == type(0):
!                         dummy = self.player.seektrack(
!                                 start)
!                     else:
!                         min, sec, frame = start
!                         dummy = self.player.seek(
!                                 min, sec, frame)
!                     if type(end) == type(0):
!                         self.parser.setcallback(
!                                 CD.PNUM, _dopnum, self)
!                         self.end = end
!                         func, arg = \
!                               self.callbacks[CD.ATIME]
!                         if func:
!                             self.parser.setcallback(CD.ATIME, func, arg)
!                         else:
!                             self.parser.removecallback(CD.ATIME)
!                     else:
!                         min, sec, frame = end
!                         self.parser.setcallback(
!                                 CD.ATIME, _doatime,
!                                 self)
!                         self.end = (min * 60 + sec) * \
!                                    75 + frame
!                         func, arg = \
!                               self.callbacks[CD.PNUM]
!                         if func:
!                             self.parser.setcallback(CD.PNUM, func, arg)
!                         else:
!                             self.parser.removecallback(CD.PNUM)
!                     self.playing = 1
!                 data = self.player.readda(size)
!                 if data == '':
!                     self.playing = 0
!                     self.listindex = self.listindex + 1
!                     continue
!                 try:
!                     self.parser.parseframe(data)
!                 except _Stop:
!                     self.playing = 0
!                     self.listindex = self.listindex + 1
!         finally:
!             self.playing = 0

Index: torgb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/torgb.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** torgb.py	12 Feb 2004 17:35:10 -0000	1.6
--- torgb.py	18 Jul 2004 06:14:45 -0000	1.7
***************
*** 52,99 ****
  
  class error(Exception):
! 	pass
  
  def torgb(filename):
! 	temps = []
! 	ret = None
! 	try:
! 		ret = _torgb(filename, temps)
! 	finally:
! 		for temp in temps[:]:
! 			if temp != ret:
! 				try:
! 					os.unlink(temp)
! 				except os.error:
! 					pass
! 				temps.remove(temp)
! 	return ret
  
  def _torgb(filename, temps):
! 	if filename[-2:] == '.Z':
! 		(fd, fname) = tempfile.mkstemp()
! 		os.close(fd)
! 		temps.append(fname)
! 		sts = uncompress.copy(filename, fname)
! 		if sts:
! 			raise error, filename + ': uncompress failed'
! 	else:
! 		fname = filename
! 	try:
! 		ftype = imghdr.what(fname)
! 	except IOError, msg:
! 		if type(msg) == type(()) and len(msg) == 2 and \
! 			type(msg[0]) == type(0) and type(msg[1]) == type(''):
! 			msg = msg[1]
! 		if type(msg) is not type(''):
! 			msg = repr(msg)
! 		raise error, filename + ': ' + msg
! 	if ftype == 'rgb':
! 		return fname
! 	if ftype is None or not table.has_key(ftype):
! 		raise error, '%s: unsupported image file type %r' % (filename, ftype)
! 	(fd, temp) = tempfile.mkstemp()
! 	os.close(fd)
! 	sts = table[ftype].copy(fname, temp)
! 	if sts:
! 		raise error, filename + ': conversion to rgb failed'
! 	return temp
--- 52,99 ----
  
  class error(Exception):
!     pass
  
  def torgb(filename):
!     temps = []
!     ret = None
!     try:
!         ret = _torgb(filename, temps)
!     finally:
!         for temp in temps[:]:
!             if temp != ret:
!                 try:
!                     os.unlink(temp)
!                 except os.error:
!                     pass
!                 temps.remove(temp)
!     return ret
  
  def _torgb(filename, temps):
!     if filename[-2:] == '.Z':
!         (fd, fname) = tempfile.mkstemp()
!         os.close(fd)
!         temps.append(fname)
!         sts = uncompress.copy(filename, fname)
!         if sts:
!             raise error, filename + ': uncompress failed'
!     else:
!         fname = filename
!     try:
!         ftype = imghdr.what(fname)
!     except IOError, msg:
!         if type(msg) == type(()) and len(msg) == 2 and \
!                 type(msg[0]) == type(0) and type(msg[1]) == type(''):
!             msg = msg[1]
!         if type(msg) is not type(''):
!             msg = repr(msg)
!         raise error, filename + ': ' + msg
!     if ftype == 'rgb':
!         return fname
!     if ftype is None or not table.has_key(ftype):
!         raise error, '%s: unsupported image file type %r' % (filename, ftype)
!     (fd, temp) = tempfile.mkstemp()
!     os.close(fd)
!     sts = table[ftype].copy(fname, temp)
!     if sts:
!         raise error, filename + ': conversion to rgb failed'
!     return temp



More information about the Python-checkins mailing list