[Python-checkins] CVS: python/dist/src/Python getargs.c,2.37,2.38 modsupport.c,2.46,2.47

Jack Jansen python-dev@python.org
Thu, 6 Jul 2000 05:22:03 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv5003

Modified Files:
	getargs.c modsupport.c 
Log Message:
Added support for H (unsigned short) specifier in PyArg_ParseTuple and 
Py_BuildValue.


Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -r2.37 -r2.38
*** getargs.c	2000/07/01 01:07:38	2.37
--- getargs.c	2000/07/06 12:22:00	2.38
***************
*** 490,493 ****
--- 490,514 ----
  		}
  	
+ 	case 'H': /* unsigned short int */
+ 		{
+ 			unsigned short *p = va_arg(*p_va, unsigned short *);
+ 			long ival = PyInt_AsLong(arg);
+ 			if (ival == -1 && PyErr_Occurred())
+ 				return "integer<H>";
+ 			else if (ival < 0) {
+ 				PyErr_SetString(PyExc_OverflowError,
+ 			      "unsigned short integer is less than minimum");
+ 				return "integer<H>";
+ 			}
+ 			else if (ival > USHRT_MAX) {
+ 				PyErr_SetString(PyExc_OverflowError,
+ 			      "unsigned short integer is greater than maximum");
+ 				return "integer<H>";
+ 			}
+ 			else
+ 				*p = (unsigned short) ival;
+ 			break;
+ 		}
+ 	
  	case 'i': /* signed int */
  		{
***************
*** 510,514 ****
  			break;
  		}
- 	
  	case 'l': /* long int */
  		{
--- 531,534 ----
***************
*** 1205,1208 ****
--- 1225,1234 ----
  		{
  			(void) va_arg(*p_va, short *);
+ 			break;
+ 		}
+ 	
+ 	case 'H': /* unsigned short int */
+ 		{
+ 			(void) va_arg(*p_va, unsigned short *);
  			break;
  		}

Index: modsupport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v
retrieving revision 2.46
retrieving revision 2.47
diff -C2 -r2.46 -r2.47
*** modsupport.c	2000/07/03 21:39:47	2.46
--- modsupport.c	2000/07/06 12:22:00	2.47
***************
*** 279,282 ****
--- 279,285 ----
  		case 'i':
  			return PyInt_FromLong((long)va_arg(*p_va, int));
+ 			
+ 		case 'H':
+ 			return PyInt_FromLong((long)va_arg(*p_va, unsigned int));
  
  		case 'l':