Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
Config.h
浏览该文件的文档.
1// Copyright 2024 libsese
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
21#pragma once
22
23#if !defined(_WIN32_WINNET) || _WIN32_WINNI < 0x0602
24#define _WIN32_WINNNT 0x0602
25#endif
26
27#ifndef WINVER
28#define WINVER 0x0602
29#endif
30
31#ifndef NOMINMAX
32#define NOMINMAX
33#endif
34
35#include <winsock2.h>
36#include <windows.h>
37
38#undef min
39#undef max
40
41#pragma warning(disable : 4819)
42
43#if defined(_M_X64)
44#define SESE_ARCH_X64
45#elif defined(_M_ARM64)
46#define SESE_ARCH_ARM64
47#else
48#error only support x86_64 & arm64
49#endif
50
52#define SESE_CXX_STANDARD _MSVC_LANG
53
55#define API
56
58#define PRIdTid "u"
59
60#ifndef __MINGW32__
62#define strcasecmp strcmpi
63#endif
64
65#ifndef timegm
66#define timegm _mkgmtime
67#endif
68
69#if defined(__MINGW32__)
70#define SESE_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
71#else
72#define SESE_FILENAME (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
73#endif
74
75namespace sese {
77using pid_t = DWORD;
79using tid_t = uint32_t;
81using socket_t = SOCKET;
82} // namespace sese
83
85
86#undef EINTR
87#undef EBADF
88#undef EACCES
89#undef EFAULT
90#undef EINVAL
91#undef EMFILE
92#undef EWOULDBLOCK
93#undef EINPROGRESS
94#undef EALREADY
95#undef ENOTSOCK
96#undef EDESTADDRREQ
97#undef EMSGSIZE
98#undef EPROTOTYPE
99#undef ENOPROTOOPT
100#undef EPROTONOSUPPORT
101#undef ESOCKTNOSUPPORT
102#undef EOPNOTSUPP
103#undef EPFNOSUPPORT
104#undef EAFNOSUPPORT
105#undef EADDRINUSE
106#undef EADDRNOTAVAIL
107#undef ENETDOWN
108#undef ENETUNREACH
109#undef ENETRESET
110#undef ECONNABORTED
111#undef ECONNRESET
112#undef ENOBUFS
113#undef EISCONN
114#undef ENOTCONN
115#undef ESHUTDOWN
116#undef ETOOMANYREFS
117#undef ETIMEDOUT
118#undef ECONNREFUSED
119#undef ELOOP
120#undef ENAMETOOLONG
121#undef EHOSTDOWN
122#undef EHOSTUNREACH
123#undef ENOTEMPTY
124#undef EPROCLIM
125#undef EUSERS
126#undef EDQUOT
127#undef ESTALE
128#undef EREMOTE
129
130#define EINTR WSAEINTR
131#define EBADF WSAEBADF
132#define EACCES WSAEACCES
133#define EFAULT WSAEFAULT
134#define EINVAL WSAEINVAL
135#define EMFILE WSAEMFILE
136#define EWOULDBLOCK WSAEWOULDBLOCK
137#define EINPROGRESS WSAEINPROGRESS
138#define EALREADY WSAEALREADY
139#define ENOTSOCK WSAENOTSOCK
140#define EDESTADDRREQ WSAEDESTADDRREQ
141#define EMSGSIZE WSAEMSGSIZE
142#define EPROTOTYPE WSAEPROTOTYPE
143#define ENOPROTOOPT WSAENOPROTOOPT
144#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
145#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
146#define EOPNOTSUPP WSAEOPNOTSUPP
147#define EPFNOSUPPORT WSAEPFNOSUPPORT
148#define EAFNOSUPPORT WSAEAFNOSUPPORT
149#define EADDRINUSE WSAEADDRINUSE
150#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
151#define ENETDOWN WSAENETDOWN
152#define ENETUNREACH WSAENETUNREACH
153#define ENETRESET WSAENETRESET
154#define ECONNABORTED WSAECONNABORTED
155#define ECONNRESET WSAECONNRESET
156#define ENOBUFS WSAENOBUFS
157#define EISCONN WSAEISCONN
158#define ENOTCONN WSAENOTCONN
159#define ESHUTDOWN WSAESHUTDOWN
160#define ETOOMANYREFS WSAETOOMANYREFS
161#define ETIMEDOUT WSAETIMEDOUT
162#define ECONNREFUSED WSAECONNREFUSED
163#define ELOOP WSAELOOP
164#define ENAMETOOLONG WSAENAMETOOLONG
165#define EHOSTDOWN WSAEHOSTDOWN
166#define EHOSTUNREACH WSAEHOSTUNREACH
167#define ENOTEMPTY WSAENOTEMPTY
168#define EPROCLIM WSAEPROCLIM
169#define EUSERS WSAEUSERS
170#define EDQUOT WSAEDQUOT
171#define ESTALE WSAESTALE
172#define EREMOTE WSAEREMOTE