[Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.1,2.2

Guido van Rossum python-dev@python.org
Thu, 30 Mar 2000 20:17:09 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Modules
In directory eric:/projects/python/develop/guido/src/Modules

Modified Files:
	mmapmodule.c 
Log Message:
Hacked for Win32 by Mark Hammond.
Reformatted for 8-space tabs and fitted into 80-char lines by GvR.

Mark writes:

* the Win32 version now accepts the same args as the Unix version.
The win32 specific "tag" param is now optional.  The end result is
that the exact same test suite runs on Windows (definately a worthy
goal!).

* I changed the error object.  All occurences of the error, except
for 1, corresponds to an underlying OS error.  This one was changed
to a ValueError (a better error for that condition), and the module
error object is now simply EnvironmentError.  All win32 error
routines now call the new Windows specific error handler.


Index: mmapmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/mmapmodule.c,v
retrieving revision 2.1
retrieving revision 2.2
diff -C2 -r2.1 -r2.2
*** mmapmodule.c	2000/03/30 21:14:30	2.1
--- mmapmodule.c	2000/03/31 01:17:07	2.2
***************
*** 1,6 ****
! /* -*- Mode: C++; tab-width: 4 -*-
!  /	Author: Sam Rushing <rushing@nightmare.com>
   /  Hacked for Unix by A.M. Kuchling <amk1@bigfoot.com> 
!  /	$Id: mmapmodule.c,v 2.1 2000/03/30 21:14:30 akuchlin Exp $
  
   / mmapmodule.cpp -- map a view of a file into memory
--- 1,6 ----
! /*
!  /  Author: Sam Rushing <rushing@nightmare.com>
   /  Hacked for Unix by A.M. Kuchling <amk1@bigfoot.com> 
[...1618 lines suppressed...]
  #ifdef MAP_ANON
! 	PyDict_SetItemString (dict, "MAP_ANON", PyInt_FromLong(MAP_ANON) );
! 	PyDict_SetItemString (dict, "MAP_ANONYMOUS",
! 			      PyInt_FromLong(MAP_ANON) );
  #endif
  
  #ifdef UNIX
! 	PyDict_SetItemString (dict, "PAGESIZE",
! 			      PyInt_FromLong( (long)getpagesize() ) );
  #endif
+ #ifdef MS_WIN32
+ 	{
+ 	    SYSTEM_INFO si;
+ 	    GetSystemInfo(&si);
+ 	    PyDict_SetItemString (dict, "PAGESIZE",
+ 				  PyInt_FromLong( si.dwPageSize ) );
+ 	}
+ #endif /* MS_WIN32 */
  
  }