]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/umapfile.h
ICU-62107.0.1.tar.gz
[apple/icu.git] / icuSources / common / umapfile.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4******************************************************************************
5*
4388f060 6* Copyright (C) 1999-2011, International Business Machines
b75a7d8f
A
7* Corporation and others. All Rights Reserved.
8*
9******************************************************************************/
10
b75a7d8f
A
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 inteded to be used directly by applications.
22 *
23 *----------------------------------------------------------------------------------*/
24
25#ifndef __UMAPFILE_H__
26#define __UMAPFILE_H__
27
729e4ab9 28#include "unicode/putil.h"
b75a7d8f 29#include "unicode/udata.h"
4388f060 30#include "putilimp.h"
b75a7d8f 31
729e4ab9
A
32U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path);
33U_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#define MAP_390DLL 4
41
42#if UCONFIG_NO_FILE_IO
43# define MAP_IMPLEMENTATION MAP_NONE
4388f060 44#elif U_PLATFORM_USES_ONLY_WIN32_API
729e4ab9 45# define MAP_IMPLEMENTATION MAP_WIN32
4388f060
A
46#elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390
47# if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA)
729e4ab9
A
48 /* No memory mapping for 390 batch mode. Fake it using dll loading. */
49# define MAP_IMPLEMENTATION MAP_390DLL
50# else
51# define MAP_IMPLEMENTATION MAP_POSIX
52# endif
53#else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */
54# define MAP_IMPLEMENTATION MAP_STDIO
55#endif
b75a7d8f
A
56
57#endif