michael@0: /* michael@0: ****************************************************************************** michael@0: * michael@0: * Copyright (C) 1999-2011, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************/ michael@0: michael@0: /*---------------------------------------------------------------------------------- michael@0: * michael@0: * Memory mapped file wrappers for use by the ICU Data Implementation michael@0: * michael@0: * Porting note: The implementation of these functions is very platform specific. michael@0: * Not all platforms can do real memory mapping. Those that can't michael@0: * still must implement these functions, getting the data into memory using michael@0: * whatever means are available. michael@0: * michael@0: * These functions are part of the ICU internal implementation, and michael@0: * are not inteded to be used directly by applications. michael@0: * michael@0: *----------------------------------------------------------------------------------*/ michael@0: michael@0: #ifndef __UMAPFILE_H__ michael@0: #define __UMAPFILE_H__ michael@0: michael@0: #include "unicode/putil.h" michael@0: #include "unicode/udata.h" michael@0: #include "putilimp.h" michael@0: michael@0: U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path); michael@0: U_CFUNC void uprv_unmapFile(UDataMemory *pData); michael@0: michael@0: /* MAP_NONE: no memory mapping, no file access at all */ michael@0: #define MAP_NONE 0 michael@0: #define MAP_WIN32 1 michael@0: #define MAP_POSIX 2 michael@0: #define MAP_STDIO 3 michael@0: #define MAP_390DLL 4 michael@0: michael@0: #if UCONFIG_NO_FILE_IO michael@0: # define MAP_IMPLEMENTATION MAP_NONE michael@0: #elif U_PLATFORM_USES_ONLY_WIN32_API michael@0: # define MAP_IMPLEMENTATION MAP_WIN32 michael@0: #elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390 michael@0: # if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA) michael@0: /* No memory mapping for 390 batch mode. Fake it using dll loading. */ michael@0: # define MAP_IMPLEMENTATION MAP_390DLL michael@0: # else michael@0: # define MAP_IMPLEMENTATION MAP_POSIX michael@0: # endif michael@0: #else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */ michael@0: # define MAP_IMPLEMENTATION MAP_STDIO michael@0: #endif michael@0: michael@0: #endif