CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
Standard.h
Go to the documentation of this file.
1
15/*
16
17 This is the file where we define all we need for different OSes,
18 like the Darwin system, that does not have various normal OS functions.
19
20*/
21
22#if !defined(__standard_h) // Sentry, use file only if it's not already included.
23#define __standard_h
24
25#pragma warning (disable : 4100)
26
27#define __LIBRARY_VERSION_STRING__ "2.0.0 Alpha1"
28
29// Will speed up STL in general and massively in debug
30#ifndef _SECURE_SCL
31 #define _SECURE_SCL 0
32 #define _SCL_SECURE_NO_DEPRECATE
33 #define _HAS_ITERATOR_DEBUGGING 0
34#endif
35
36#include <list>
37#include <map>
38#include <queue>
39#include "bimap.h"
40#include <iostream>
41#include <string>
42#include <fstream>
43#include <sstream>
44
45// #pragma warning( disable : 4995 )
46
47#if defined(WIN32_PLATFORM_PSPC)
48 // Code for either Windows Mobile 6 Classic
49 // or Windows Mobile 6 Professional.
50 #define POCKETPC
51 #define WINDOWS
52 #define NATIVESYSTEMNAME "Win32PPC"
53 #define COMPILERVERSION _MSC_VER
54// #if (WIN32_PLATFORM_PSPC = 400)
55 // Code for Windows Mobile 2003.
56// #elif (WIN32_PLATFORM_PSPC = 310)
57 // Code for Pocket PC 2002.
58// #endif
59#elif defined(__CYGWIN__)
60 #define NATIVESYSTEMNAME "Win32Cygwin"
61 #define COMPILERVERSION GCC_VERSION
62 #define WINDOWS
63 #if defined(__x86_64)
64 #define ARCH_64
65 #elif defined(__i386)
66 #define ARCH_32
67 #endif
68#elif defined(_WIN64)
69 #define WINDOWS
70 #define ARCH_64
71 #define WIN_VS
72 #if _MSC_VER < 1300
73 #define WIN_VS6
74 #define NATIVESYSTEMNAME "Win32VS6"
75 #else
76 #define WIN_VSNET
77 #define NATIVESYSTEMNAME "Win32VSNET"
78 #endif // _MSC_VER < 1300
79 #define COMPILERVERSION _MSC_VER
80#elif defined(_WIN32)
81 #define WINDOWS
82 #define ARCH_32
83 #define WIN_VS
84 #if _MSC_VER < 1300
85 #define WIN_VS6
86 #define NATIVESYSTEMNAME "Win32VS6"
87 #else
88 #define WIN_VSNET
89 #define NATIVESYSTEMNAME "Win32VSNET"
90 #endif // _MSC_VER < 1300
91 #define COMPILERVERSION _MSC_VER
92#elif defined(__GNUC__)
93
94 #if defined(__x86_64)
95 #define ARCH_64
96 #elif defined(__i386)
97 #define ARCH_32
98 #elif defined(__aarch64__)
99 #define ARCH_64
100 #endif
101 #if defined(__linux)
102 #define LINUX
103 #define NATIVESYSTEMNAME "Unix"
104 #elif defined(__APPLE__)
105 #define OSX
106 #define DARWIN
107 #define NATIVESYSTEMNAME "Darwin"
108 #endif
109 #define COMPILERVERSION GCC_VERSION
110#endif
111
112//3.1415926535
113#define clPI 3.14159265358979323846264
114#define clmax(a,b) (((a) > (b)) ? (a) : (b))
115#define clmin(a,b) (((a) < (b)) ? (a) : (b))
116#define clround(x) (int) (((x) - floor(x)) >= 0.5 ? (floor(x) + 1) : (floor(x)))
117#define clsqr(x) ((x) * (x))
118#define clsign(x) (((x) < 0) ? (-1) : (1))
119#define clabs(a) ((a)<0?-(a):(a))
120
121#if defined(WIN_VS)
122 #if !defined(POCKETPC)
123 #if defined(_DEBUG)
124 //#define _CRTDBG_MAP_ALLOC
125 //#include <stdlib.h>
126 //#include <crtdbg.h>
127 //#define MY_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__)
128 //#define new MY_NEW
129 //#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
130 #endif
131 #endif
132#endif
133
134#if defined(CYGWIN)
135 #include <winsock2.h>
136#endif
137
138#if defined(__GNUC__)
139
140 #ifdef __GNUC_PATCHLEVEL__
141 #define GCC_VERSION (__GNUC__ * 10000 \
142 + __GNUC_MINOR__ * 100 \
143 + __GNUC_PATCHLEVEL__)
144 #else
145 #define GCC_VERSION (__GNUC__ * 10000 \
146 + __GNUC_MINOR__ * 100)
147 #endif
148 //#if __GNUC__ == 4
149 // #if __GNUC_MINOR__ < 3
150 // #error "GNU C++ 4.3 or later is required to compile this program"
151 // #endif /* __GNUC_MINOR__ */
152 //#endif /* __GNUC__ */
153 #define _open open
154 #define _close close
155#endif
156
157#ifdef WINDOWS
158 #define longlong signed __int64
159 // typedef signed __int64 longlong;
160// #include <windows.h>
161// #include <RpcDce.h>
162 #ifndef snprintf
163 #define snprintf sprintf_s
164 #endif // snprintf
165 #define stricmp _stricmp
166 //#define snprintf sprintf_s
167 #define ssscanf sscanf_s
168 #define strnicmp _strnicmp
169#else
170
171 typedef long long longlong;
172 #ifdef Darwin
173 #else
174 #endif // Darwin
175
176 #include <unistd.h>
177 #include <pthread.h>
178 #ifndef __APPLE__
179 #include <semaphore.h>
180 #endif
181
182 #ifndef __int64
183 typedef long long __int64;
184 #endif
185
186 #define HAVE_TIMEZONE_VAR 1
187 #define ssscanf sscanf
188 #define strnicmp strncasecmp
189#endif
190
191#if !defined(POCKETPC)
192 #include <signal.h>
193#endif
194
195#include <stdlib.h>
196#include <ctype.h>
197
198#endif // __standard_h
long long __int64
Definition Standard.h:183
long long longlong
Definition Standard.h:171
Third-party (vendored): STL-like bidirectional map by Joaquin M Lopez Munoz (2002-2006).