]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/umapfile.h
ICU-461.17.tar.gz
[apple/icu.git] / icuSources / common / umapfile.h
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2010, 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
29 U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path);
30 U_CFUNC void uprv_unmapFile(UDataMemory *pData);
31
32 /* MAP_NONE: no memory mapping, no file access at all */
33 #define MAP_NONE 0
34 #define MAP_WIN32 1
35 #define MAP_POSIX 2
36 #define MAP_STDIO 3
37 #define MAP_390DLL 4
38
39 #if UCONFIG_NO_FILE_IO
40 # define MAP_IMPLEMENTATION MAP_NONE
41 #elif defined(U_WINDOWS)
42 # define MAP_IMPLEMENTATION MAP_WIN32
43 #elif U_HAVE_MMAP || defined(OS390)
44 # if defined(OS390) && defined (OS390_STUBDATA)
45 /* No memory mapping for 390 batch mode. Fake it using dll loading. */
46 # define MAP_IMPLEMENTATION MAP_390DLL
47 # else
48 # define MAP_IMPLEMENTATION MAP_POSIX
49 # endif
50 #else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */
51 # define MAP_IMPLEMENTATION MAP_STDIO
52 #endif
53
54 #endif