FirteX-高性能全文索引和检索平台

API Documentation


首页 | 名字空间列表 | 类继承关系 | 组合类型列表 | $(BL\录(B | 文件列表 | 名字空间成员 | 组合类型成员 | 文件成员

platform.h

浏览该文件的文档。
00001 //
00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 
00003 // All rights reserved.
00004 // This file is part of FirteX (www.firtex.org)
00005 //
00006 // Use of the FirteX is subject to the terms of the software license set forth in 
00007 // the LICENSE file included with this software, and also available at
00008 // http://www.firtex.org/license.html
00009 //
00010 // Author       : 郭瑞杰(GuoRuijie)
00011 // Email        : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com
00012 // Created      : 2005/10/20
00013 //
00014 #ifndef _PLATFORM_H
00015 #define _PLATFORM_H
00016 
00017 
00018 #ifndef WIN32
00019         /* G++ support */
00020         #include <stddef.h>
00021         #include <limits.h>
00022         #include <float.h>
00023         #include <unistd.h>
00024         #include <sys/socket.h>
00025         #include <sys/types.h>
00026         #include <sys/stat.h>
00027         #include <netdb.h>
00028         #include <arpa/inet.h>
00029         #include <fcntl.h>
00030         #include <errno.h>
00031         extern int errno;
00032 
00033         #include "tchar.h"
00034 
00035         #include "stdint.h"
00036 
00037         extern int64_t _filelength(int filehandle);
00038         extern int64_t _tcstoi64(const tchar* str, tchar**end, int radix);
00039         extern int GetModuleFileName( char* sModuleName, char* sFileName, int nSize);
00040 
00041 
00042         #define fileOpen                _topen
00043         #define fileClose               close
00044         #define fileRead                read
00045         #define fileWrite               write
00046         #define fileSeek                lseek
00047         #define fileSize                _filelength     
00048 
00049 #ifdef FX_HAVE_TELL
00050         #define fileTell tell
00051 #else
00052         //ftell (and probably soon ftell64) are POSIX standard functions, but tell and
00053         //tell64 are not, so we define fileTell in terms of fileSeek.
00054         #define fileTell(fhandle) fileSeek(fhandle, 0, SEEK_CUR)
00055 #endif
00056 
00057         #define fileNo(X)               fileno((X))
00058         #define fileStat                stat
00059 
00060         #define _time64                 time
00061         #define _gmtime64               gmtime
00062         #define _localtime64    localtime
00063 
00064         #define _strtoi64               strtoll
00065 
00066         #define O_RANDOM                0
00067         #undef O_BINARY
00068         #define O_BINARY                0
00069         #define _S_IREAD                0444
00070         #define _S_IWRITE               0333  // write and execute permissions
00071 
00072         #define stricmp                 strcasecmp
00073         #define strnicmp                strncasecmp
00074         #define wcsnicmp                wcsncasecmp
00075         #define wcsicmp                 wcscasecmp
00076 
00077         #define _mkdir(x)               mkdir(x,0777)
00078         #define _unlink                 unlink
00079 #if !defined(__MINGW32__)
00080         #define _close                  ::close
00081         #define _read                   ::read
00082 #endif
00083 
00084 
00085         #define PATH_DELIMITERA "/"
00086 
00087 #else//for Win32
00088 
00089         #define HAVE_TCHAR_H
00090 
00091         #include <sys/types.h>
00092         #include <sys/stat.h>
00093         #include <direct.h>     
00094 //      #include <windows.h>
00095         #include <fcntl.h>
00096         #include <string>
00097         #include <io.h>
00098         #include "tchar.h"      
00099         #include <time.h>
00100 
00101         #include "stdint.h"
00102         
00103         #define fileOpen        _topen
00104         #define fileClose       _close
00105         #define fileRead        _read
00106         #define fileWrite       _write
00107         #define fileSize        _filelengthi64
00108         #define fileSeek        _lseeki64
00109         #define fileTell        _telli64        
00110         #define fileNo(X)       _fileno((X))    
00111         # define fileStat       _stati64
00112 
00113         #define PATH_DELIMITERA "\\"
00114 #endif //end for Win32
00115 
00116 #endif /* _PLATFORM_H */

http://www.firtex.org http://www.sourceforge.net/projects/firtex