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