YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
NativeAPI.h
浏览该文件的文档.
1 /*
2  © 2011-2014 FrankHB.
3 
4  This file is part of the YSLib project, and may only be used,
5  modified, and distributed under the terms of the YSLib project
6  license, LICENSE.TXT. By continuing to use, modify, or distribute
7  this file you indicate that you have read the license and
8  understand and accept it fully.
9 */
10 
28 #ifndef YCL_INC_NativeAPI_h_
29 #define YCL_INC_NativeAPI_h_ 1
30 
31 //平台定义。
32 #include "YModules.h"
33 #include YFM_YCLib_Platform
34 
35 #include <ydef.h>
36 #include YFM_YBaseMacro
37 
38 #ifndef YF_Platform
39 # error "Unknown platform found."
40 #endif
41 
42 #define YCL_YCOMMON_H <ycommon.h>
43 #define YSL_YSBUILD_H <ysbuild.h>
44 
61 namespace platform_replace
62 {} // namespace platform_replace;
63 
64 
65 #ifdef YCL_API_USE_UNISTD
66 #include <unistd.h>
67 #endif
68 
69 #ifdef YCL_API_USE_SYS_DIR
70 #include <sys/dir.h>
71 #endif
72 
73 
74 #if YCL_DS
75 
76 #include <nds.h>
77 #include <fat.h>
78 //包含 PALib 。
79 //#include <PA9.h>
80 
81 #ifdef USE_EFS
82 //包含 EFSLib 。
83 #include "efs_lib.h"
84 #endif
85 
86 namespace platform_ex
87 {
88 
98 inline void
99 DMAFillWordsAsync(u8 chan, u32 val, void* p_dst, u32 size)
100 {
101  DMA_FILL(chan) = vu32(val);
102  DMA_SRC(3) = u32(&DMA_FILL(3));
103  DMA_DEST(3) = u32(p_dst);
104 
105  DMA_CR(3) = DMA_SRC_FIX | DMA_COPY_WORDS | size >> 2;
106 }
107 
108 } // namespace platform_ex;
109 
110 
111 #elif YCL_Win32
112 
113 #ifndef UNICODE
114 # define UNICODE 1
115 #endif
116 
117 #ifndef WINVER
118 # define WINVER 0x0501
120 #endif
121 
122 #ifndef WIN32_LEAN_AND_MEAN
123 # define WIN32_LEAN_AND_MEAN 1
125 #endif
126 
127 #include <Windows.h>
128 #include <direct.h> // for ::_mkdir;
129 #include <sys/stat.h>
130 
136 #undef DialogBox
137 
143 #undef DrawText
144 
150 #undef FindWindow
151 
157 #undef GetObject
158 
164 #undef PostMessage
165 
166 
167 #define NAME_MAX 256
168 
169 #define S_IFIFO _S_IFIFO
170 
171 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
172 #define S_IRGRP 0
173 #define S_IWGRP 0
174 #define S_IXGRP 0
175 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
176 #define S_IROTH 0
177 #define S_IWOTH 0
178 #define S_IXOTH 0
179 
180 
181 namespace platform_replace
182 {
183 
189 inline int
190 makedir(char const* dir, ::mode_t)
191 {
192  return ::_mkdir(dir);
193 }
194 
195 } // namespace platform_replace;
196 
197 
198 extern "C"
199 {
200 
207 #define mkdir platform_replace::makedir
208 
209 
210 # if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
211 YF_API struct ::tm* __cdecl __MINGW_NOTHROW
213 _gmtime32(const ::__time32_t*);
214 # endif
215 
216 } // extern "C";
217 
218 
219 namespace platform_ex
220 {
221 
226 inline PDefH(bool, IsDirectory, const ::WIN32_FIND_DATAA& d) ynothrow
227  ImplRet(d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
232 inline PDefH(bool, IsDirectory, const ::WIN32_FIND_DATAW& d) ynothrow
233  ImplRet(d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
234 
235 } // namespace platform_ex;
236 
237 #endif
238 
239 #endif
240 
#define ImplRet(...)
Definition: YBaseMacro.h:97
std::uint32_t u32
Definition: yadaptor.h:69
#define YF_API
Definition: Platform.h:64
系统环境和公用类型和宏的基础定义。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
volatile u32 vu32
Definition: yadaptor.h:77
std::uint8_t u8
通用数据类型。
Definition: yadaptor.h:67