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