]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/umapfile.h
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / umapfile.h
index c9cf4198587124510741d0400e61106d421c5564..92bd567a2a98952845eb489391092a6a64d9dfbc 100644 (file)
@@ -1,12 +1,13 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 ******************************************************************************
 *
-*   Copyright (C) 1999-2001, International Business Machines
+*   Copyright (C) 1999-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************/
 
-
 /*----------------------------------------------------------------------------------
  *
  *       Memory mapped file wrappers for use by the ICU Data Implementation
 #ifndef __UMAPFILE_H__
 #define __UMAPFILE_H__
 
+#include "unicode/putil.h"
 #include "unicode/udata.h"
+#include "putilimp.h"
+
+U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status);
+U_CFUNC void  uprv_unmapFile(UDataMemory *pData);
 
-UBool   uprv_mapFile(UDataMemory *pdm, const char *path);
-void    uprv_unmapFile(UDataMemory *pData);
-char *  uprv_computeDirPath(const char *path, char *pathBuffer);
+/* MAP_NONE: no memory mapping, no file access at all */
+#define MAP_NONE        0
+#define MAP_WIN32       1
+#define MAP_POSIX       2
+#define MAP_STDIO       3
+#define MAP_390DLL      4
+
+#if UCONFIG_NO_FILE_IO
+#   define MAP_IMPLEMENTATION MAP_NONE
+#elif U_PLATFORM_USES_ONLY_WIN32_API
+#   define MAP_IMPLEMENTATION MAP_WIN32
+#elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390
+#   if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA)
+        /*   No memory mapping for 390 batch mode.  Fake it using dll loading.  */
+#       define MAP_IMPLEMENTATION MAP_390DLL
+#   else
+#       define MAP_IMPLEMENTATION MAP_POSIX
+#   endif
+#else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */
+#   define MAP_IMPLEMENTATION MAP_STDIO
+#endif
 
 #endif