[Python-checkins] python/dist/src/Mac/Modules/snd _Sndmodule.c,1.12,1.13 sndscan.py,1.18,1.19 sndsupport.py,1.20,1.21

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Thu, 12 Dec 2002 02:31:55 -0800


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

Modified Files:
	_Sndmodule.c sndscan.py sndsupport.py 
Log Message:
Getting rid of pre-Carbon (MacOS8) support. All code depending on
TARGET_API_MAC_OS8 (or !TARGET_API_MAC_CARBON) is gone. Also some
TARGET_API_MAC_OSX conditional code is gone, because it is no longer
used on OSX-only Python (only in MacPython-OS9).


Index: _Sndmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/_Sndmodule.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** _Sndmodule.c	3 Dec 2002 23:40:21 -0000	1.12
--- _Sndmodule.c	12 Dec 2002 10:31:53 -0000	1.13
***************
*** 28,40 ****
  #endif
  
- #if !TARGET_API_MAC_CARBON
- /* Create a SndCommand object (an (int, int, int) tuple) */
- static PyObject *
- SndCmd_New(SndCommand *pc)
- {
- 	return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2);
- }
- #endif
- 
  /* Convert a SndCommand argument */
  static int
--- 28,31 ----
***************
*** 55,61 ****
  static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */
  static pascal void SPB_completion(SPBPtr my_spb); /* Forward */
- #if !TARGET_API_MAC_CARBON
- static pascal void SPB_interrupt(SPBPtr my_spb); /* Forward */
- #endif
  
  static PyObject *Snd_Error;
--- 46,49 ----
***************
*** 148,217 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *SndCh_SndStartFilePlay(SndChannelObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	short fRefNum;
- 	short resNum;
- 	long bufferSize;
- 	Boolean async;
- 	if (!PyArg_ParseTuple(_args, "hhlb",
- 	                      &fRefNum,
- 	                      &resNum,
- 	                      &bufferSize,
- 	                      &async))
- 		return NULL;
- 	_err = SndStartFilePlay(_self->ob_itself,
- 	                        fRefNum,
- 	                        resNum,
- 	                        bufferSize,
- 	                        0,
- 	                        0,
- 	                        0,
- 	                        async);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	Py_INCREF(Py_None);
- 	_res = Py_None;
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *SndCh_SndPauseFilePlay(SndChannelObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	if (!PyArg_ParseTuple(_args, ""))
- 		return NULL;
- 	_err = SndPauseFilePlay(_self->ob_itself);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	Py_INCREF(Py_None);
- 	_res = Py_None;
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *SndCh_SndStopFilePlay(SndChannelObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	Boolean quietNow;
- 	if (!PyArg_ParseTuple(_args, "b",
- 	                      &quietNow))
- 		return NULL;
- 	_err = SndStopFilePlay(_self->ob_itself,
- 	                       quietNow);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	Py_INCREF(Py_None);
- 	_res = Py_None;
- 	return _res;
- }
- #endif
- 
  static PyObject *SndCh_SndChannelStatus(SndChannelObject *_self, PyObject *_args)
  {
--- 136,139 ----
***************
*** 277,295 ****
  	{"SndPlay", (PyCFunction)SndCh_SndPlay, 1,
  	 PyDoc_STR("(SndListHandle sndHandle, Boolean async) -> None")},
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1,
- 	 PyDoc_STR("(short fRefNum, short resNum, long bufferSize, Boolean async) -> None")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1,
- 	 PyDoc_STR("() -> None")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1,
- 	 PyDoc_STR("(Boolean quietNow) -> None")},
- #endif
  	{"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1,
  	 PyDoc_STR("(short theLength) -> (SCStatus theStatus)")},
--- 199,202 ----
***************
*** 580,603 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_SndControl(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	short id;
- 	SndCommand cmd;
- 	if (!PyArg_ParseTuple(_args, "h",
- 	                      &id))
- 		return NULL;
- 	_err = SndControl(id,
- 	                  &cmd);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	_res = Py_BuildValue("O&",
- 	                     SndCmd_New, &cmd);
- 	return _res;
- }
- #endif
- 
  static PyObject *Snd_SndSoundManagerVersion(PyObject *_self, PyObject *_args)
  {
--- 487,490 ----
***************
*** 656,854 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_MACEVersion(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	NumVersion _rv;
- 	if (!PyArg_ParseTuple(_args, ""))
- 		return NULL;
- 	_rv = MACEVersion();
- 	_res = Py_BuildValue("O&",
- 	                     PyMac_BuildNumVersion, _rv);
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_Comp3to1(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	char *buffer__in__;
- 	char *buffer__out__;
- 	long buffer__len__;
- 	int buffer__in_len__;
- 	StateBlock *state__in__;
- 	StateBlock state__out__;
- 	int state__in_len__;
- 	unsigned long numChannels;
- 	unsigned long whichChannel;
- 	if (!PyArg_ParseTuple(_args, "s#s#ll",
- 	                      &buffer__in__, &buffer__in_len__,
- 	                      (char **)&state__in__, &state__in_len__,
- 	                      &numChannels,
- 	                      &whichChannel))
- 		return NULL;
- 	if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
- 	{
- 		PyErr_NoMemory();
- 		goto buffer__error__;
- 	}
- 	buffer__len__ = buffer__in_len__;
- 	if (state__in_len__ != sizeof(StateBlock))
- 	{
- 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
- 		goto state__error__;
- 	}
- 	Comp3to1(buffer__in__, buffer__out__, (long)buffer__len__,
- 	         state__in__, &state__out__,
- 	         numChannels,
- 	         whichChannel);
- 	_res = Py_BuildValue("s#s#",
- 	                     buffer__out__, (int)buffer__len__,
- 	                     (char *)&state__out__, (int)sizeof(StateBlock));
-  state__error__: ;
- 	free(buffer__out__);
-  buffer__error__: ;
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_Exp1to3(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	char *buffer__in__;
- 	char *buffer__out__;
- 	long buffer__len__;
- 	int buffer__in_len__;
- 	StateBlock *state__in__;
- 	StateBlock state__out__;
- 	int state__in_len__;
- 	unsigned long numChannels;
- 	unsigned long whichChannel;
- 	if (!PyArg_ParseTuple(_args, "s#s#ll",
- 	                      &buffer__in__, &buffer__in_len__,
- 	                      (char **)&state__in__, &state__in_len__,
- 	                      &numChannels,
- 	                      &whichChannel))
- 		return NULL;
- 	if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
- 	{
- 		PyErr_NoMemory();
- 		goto buffer__error__;
- 	}
- 	buffer__len__ = buffer__in_len__;
- 	if (state__in_len__ != sizeof(StateBlock))
- 	{
- 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
- 		goto state__error__;
- 	}
- 	Exp1to3(buffer__in__, buffer__out__, (long)buffer__len__,
- 	        state__in__, &state__out__,
- 	        numChannels,
- 	        whichChannel);
- 	_res = Py_BuildValue("s#s#",
- 	                     buffer__out__, (int)buffer__len__,
- 	                     (char *)&state__out__, (int)sizeof(StateBlock));
-  state__error__: ;
- 	free(buffer__out__);
-  buffer__error__: ;
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_Comp6to1(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	char *buffer__in__;
- 	char *buffer__out__;
- 	long buffer__len__;
- 	int buffer__in_len__;
- 	StateBlock *state__in__;
- 	StateBlock state__out__;
- 	int state__in_len__;
- 	unsigned long numChannels;
- 	unsigned long whichChannel;
- 	if (!PyArg_ParseTuple(_args, "s#s#ll",
- 	                      &buffer__in__, &buffer__in_len__,
- 	                      (char **)&state__in__, &state__in_len__,
- 	                      &numChannels,
- 	                      &whichChannel))
- 		return NULL;
- 	if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
- 	{
- 		PyErr_NoMemory();
- 		goto buffer__error__;
- 	}
- 	buffer__len__ = buffer__in_len__;
- 	if (state__in_len__ != sizeof(StateBlock))
- 	{
- 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
- 		goto state__error__;
- 	}
- 	Comp6to1(buffer__in__, buffer__out__, (long)buffer__len__,
- 	         state__in__, &state__out__,
- 	         numChannels,
- 	         whichChannel);
- 	_res = Py_BuildValue("s#s#",
- 	                     buffer__out__, (int)buffer__len__,
- 	                     (char *)&state__out__, (int)sizeof(StateBlock));
-  state__error__: ;
- 	free(buffer__out__);
-  buffer__error__: ;
- 	return _res;
- }
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_Exp1to6(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	char *buffer__in__;
- 	char *buffer__out__;
- 	long buffer__len__;
- 	int buffer__in_len__;
- 	StateBlock *state__in__;
- 	StateBlock state__out__;
- 	int state__in_len__;
- 	unsigned long numChannels;
- 	unsigned long whichChannel;
- 	if (!PyArg_ParseTuple(_args, "s#s#ll",
- 	                      &buffer__in__, &buffer__in_len__,
- 	                      (char **)&state__in__, &state__in_len__,
- 	                      &numChannels,
- 	                      &whichChannel))
- 		return NULL;
- 	if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
- 	{
- 		PyErr_NoMemory();
- 		goto buffer__error__;
- 	}
- 	buffer__len__ = buffer__in_len__;
- 	if (state__in_len__ != sizeof(StateBlock))
- 	{
- 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
- 		goto state__error__;
- 	}
- 	Exp1to6(buffer__in__, buffer__out__, (long)buffer__len__,
- 	        state__in__, &state__out__,
- 	        numChannels,
- 	        whichChannel);
- 	_res = Py_BuildValue("s#s#",
- 	                     buffer__out__, (int)buffer__len__,
- 	                     (char *)&state__out__, (int)sizeof(StateBlock));
-  state__error__: ;
- 	free(buffer__out__);
-  buffer__error__: ;
- 	return _res;
- }
- #endif
- 
  static PyObject *Snd_GetSysBeepVolume(PyObject *_self, PyObject *_args)
  {
--- 543,546 ----
***************
*** 1042,1070 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_SndRecordToFile(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	Point corner;
- 	OSType quality;
- 	short fRefNum;
- 	if (!PyArg_ParseTuple(_args, "O&O&h",
- 	                      PyMac_GetPoint, &corner,
- 	                      PyMac_GetOSType, &quality,
- 	                      &fRefNum))
- 		return NULL;
- 	_err = SndRecordToFile((ModalFilterUPP)0,
- 	                       corner,
- 	                       quality,
- 	                       fRefNum);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	Py_INCREF(Py_None);
- 	_res = Py_None;
- 	return _res;
- }
- #endif
- 
  static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args)
  {
--- 734,737 ----
***************
*** 1173,1200 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- 
- static PyObject *Snd_SPBRecordToFile(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	OSErr _err;
- 	short fRefNum;
- 	SPBPtr inParamPtr;
- 	Boolean asynchFlag;
- 	if (!PyArg_ParseTuple(_args, "hO&b",
- 	                      &fRefNum,
- 	                      SPBObj_Convert, &inParamPtr,
- 	                      &asynchFlag))
- 		return NULL;
- 	_err = SPBRecordToFile(fRefNum,
- 	                       inParamPtr,
- 	                       asynchFlag);
- 	if (_err != noErr) return PyMac_Error(_err);
- 	Py_INCREF(Py_None);
- 	_res = Py_None;
- 	return _res;
- }
- #endif
- 
  static PyObject *Snd_SPBPauseRecording(PyObject *_self, PyObject *_args)
  {
--- 840,843 ----
***************
*** 1357,1365 ****
  	{"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
  	 PyDoc_STR("(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)")},
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SndControl", (PyCFunction)Snd_SndControl, 1,
- 	 PyDoc_STR("(short id) -> (SndCommand cmd)")},
- #endif
  	{"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1,
  	 PyDoc_STR("() -> (NumVersion _rv)")},
--- 1000,1003 ----
***************
*** 1370,1398 ****
  	{"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1,
  	 PyDoc_STR("(short sysBeepState) -> None")},
- 
- #if !TARGET_API_MAC_CARBON
- 	{"MACEVersion", (PyCFunction)Snd_MACEVersion, 1,
- 	 PyDoc_STR("() -> (NumVersion _rv)")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"Comp3to1", (PyCFunction)Snd_Comp3to1, 1,
- 	 PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"Exp1to3", (PyCFunction)Snd_Exp1to3, 1,
- 	 PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"Comp6to1", (PyCFunction)Snd_Comp6to1, 1,
- 	 PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")},
- #endif
- 
- #if !TARGET_API_MAC_CARBON
- 	{"Exp1to6", (PyCFunction)Snd_Exp1to6, 1,
- 	 PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")},
- #endif
  	{"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1,
  	 PyDoc_STR("() -> (long level)")},
--- 1008,1011 ----
***************
*** 1417,1425 ****
  	{"SndRecord", (PyCFunction)Snd_SndRecord, 1,
  	 PyDoc_STR("(Point corner, OSType quality) -> (SndListHandle sndHandle)")},
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SndRecordToFile", (PyCFunction)Snd_SndRecordToFile, 1,
- 	 PyDoc_STR("(Point corner, OSType quality, short fRefNum) -> None")},
- #endif
  	{"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1,
  	 PyDoc_STR("(short deviceRefNum, Str255 deviceName) -> None")},
--- 1030,1033 ----
***************
*** 1434,1442 ****
  	{"SPBRecord", (PyCFunction)Snd_SPBRecord, 1,
  	 PyDoc_STR("(SPBPtr inParamPtr, Boolean asynchFlag) -> None")},
- 
- #if !TARGET_API_MAC_CARBON
- 	{"SPBRecordToFile", (PyCFunction)Snd_SPBRecordToFile, 1,
- 	 PyDoc_STR("(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag) -> None")},
- #endif
  	{"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1,
  	 PyDoc_STR("(long inRefNum) -> None")},
--- 1042,1045 ----
***************
*** 1522,1539 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- static pascal void
- SPB_interrupt(SPBPtr my_spb)
- {
- 	SPBObject *p = (SPBObject *)(my_spb->userLong);
- 	
- 	if (p && p->ob_interrupt) {
- 		long A5 = SetA5(p->ob_A5);
- 		p->ob_thiscallback = p->ob_interrupt;	/* Hope we cannot get two at the same time */
- 		Py_AddPendingCall(SPB_CallCallBack, (void *)p);
- 		SetA5(A5);
- 	}
- }
- #endif
  
  
--- 1125,1128 ----

Index: sndscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndscan.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** sndscan.py	15 Aug 2002 21:48:15 -0000	1.18
--- sndscan.py	12 Dec 2002 10:31:53 -0000	1.19
***************
*** 50,71 ****
  			'rate44khz',
  			'kInvalidSource',
  
  			]
- 
- 	def makegreylist(self):
- 		return [
- 			('#if !TARGET_API_MAC_CARBON', [
- 				'MACEVersion',
- 				'SPBRecordToFile',
- 				'Exp1to6',
- 				'Comp6to1',
- 				'Exp1to3',
- 				'Comp3to1',
- 				'SndControl',
- 				'SndStopFilePlay',
- 				'SndStartFilePlay',
- 				'SndPauseFilePlay',
- 				'SndRecordToFile',
- 			])]
  
  	def makeblacklisttypes(self):
--- 50,67 ----
  			'rate44khz',
  			'kInvalidSource',
+ 			# OS8 only:
+ 			'MACEVersion',
+ 			'SPBRecordToFile',
+ 			'Exp1to6',
+ 			'Comp6to1',
+ 			'Exp1to3',
+ 			'Comp3to1',
+ 			'SndControl',
+ 			'SndStopFilePlay',
+ 			'SndStartFilePlay',
+ 			'SndPauseFilePlay',
+ 			'SndRecordToFile',
  
  			]
  
  	def makeblacklisttypes(self):

Index: sndsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndsupport.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** sndsupport.py	29 Nov 2002 23:40:47 -0000	1.20
--- sndsupport.py	12 Dec 2002 10:31:53 -0000	1.21
***************
*** 97,109 ****
  
  includestuff = includestuff + """
- #if !TARGET_API_MAC_CARBON
- /* Create a SndCommand object (an (int, int, int) tuple) */
- static PyObject *
- SndCmd_New(SndCommand *pc)
- {
- 	return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2);
- }
- #endif
- 
  /* Convert a SndCommand argument */
  static int
--- 97,100 ----
***************
*** 124,130 ****
  static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */
  static pascal void SPB_completion(SPBPtr my_spb); /* Forward */
- #if !TARGET_API_MAC_CARBON
- static pascal void SPB_interrupt(SPBPtr my_spb); /* Forward */
- #endif
  """
  
--- 115,118 ----
***************
*** 193,210 ****
  }
  
- #if !TARGET_API_MAC_CARBON
- static pascal void
- SPB_interrupt(SPBPtr my_spb)
- {
- 	SPBObject *p = (SPBObject *)(my_spb->userLong);
- 	
- 	if (p && p->ob_interrupt) {
- 		long A5 = SetA5(p->ob_A5);
- 		p->ob_thiscallback = p->ob_interrupt;	/* Hope we cannot get two at the same time */
- 		Py_AddPendingCall(SPB_CallCallBack, (void *)p);
- 		SetA5(A5);
- 	}
- }
- #endif
  """
  
--- 181,184 ----