• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 ******************************************************************************
3 *
4 *   Copyright (C) 1999-2011, International Business Machines
5 *   Corporation and others.  All Rights Reserved.
6 *
7 ******************************************************************************/
8 
9 /*----------------------------------------------------------------------------------
10  *
11  *       Memory mapped file wrappers for use by the ICU Data Implementation
12  *
13  *           Porting note:  The implementation of these functions is very platform specific.
14  *             Not all platforms can do real memory mapping.  Those that can't
15  *             still must implement these functions, getting the data into memory using
16  *             whatever means are available.
17  *
18  *            These functions are part of the ICU internal implementation, and
19  *            are not inteded to be used directly by applications.
20  *
21  *----------------------------------------------------------------------------------*/
22 
23 #ifndef __UMAPFILE_H__
24 #define __UMAPFILE_H__
25 
26 #include "unicode/putil.h"
27 #include "unicode/udata.h"
28 #include "putilimp.h"
29 
30 U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path);
31 U_CFUNC void  uprv_unmapFile(UDataMemory *pData);
32 
33 /* MAP_NONE: no memory mapping, no file access at all */
34 #define MAP_NONE        0
35 #define MAP_WIN32       1
36 #define MAP_POSIX       2
37 #define MAP_STDIO       3
38 #define MAP_390DLL      4
39 
40 #if UCONFIG_NO_FILE_IO
41 #   define MAP_IMPLEMENTATION MAP_NONE
42 #elif U_PLATFORM_USES_ONLY_WIN32_API
43 #   define MAP_IMPLEMENTATION MAP_WIN32
44 #elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390
45 #   if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA)
46         /*   No memory mapping for 390 batch mode.  Fake it using dll loading.  */
47 #       define MAP_IMPLEMENTATION MAP_390DLL
48 #   else
49 #       define MAP_IMPLEMENTATION MAP_POSIX
50 #   endif
51 #else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */
52 #   define MAP_IMPLEMENTATION MAP_STDIO
53 #endif
54 
55 #endif
56