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