This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
/
sciter-x-types.h
313 lines (243 loc) · 5.96 KB
/
sciter-x-types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*
* The Sciter Engine of Terra Informatica Software, Inc.
* http://sciter.com
*
* The code and information provided "as-is" without
* warranty of any kind, either expressed or implied.
*
* (C) 2003-2015, Terra Informatica Software, Inc.
*/
/*
* Sciter basic types, platform isolation declarations
*/
#ifndef sciter_sciter_x_types_h
#define sciter_sciter_x_types_h
#ifdef __cplusplus
#if __cplusplus >= 201103L
#define CPP11
#elif _MSC_VER >= 1600
#define CPP11
#endif
#include <string>
#else
#include <stdbool.h>
#endif
enum GFX_LAYER
{
GFX_LAYER_GDI = 1, GFX_LAYER_CG = 1, /*Mac OS*/ GFX_LAYER_CAIRO = 1, /*GTK*/
GFX_LAYER_WARP = 2,
GFX_LAYER_D2D = 3,
GFX_LAYER_SKIA = 4,
GFX_LAYER_SKIA_OPENGL = 5,
GFX_LAYER_AUTO = 0xFFFF,
};
#if defined(_WIN32) || defined(_WIN64)
#define WINDOWS
#elif defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#define IOS
#elif TARGET_OS_MAC
#define OSX
#else
#error "This platform is not supported yet"
#endif
#elif defined(__linux__)
#ifndef LINUX
#define LINUX
#endif
#else
#error "This platform is not supported yet"
#endif
#if defined(WINDOWS)
#include <specstrings.h>
#include <windows.h>
#include <oaidl.h>
/*#if defined(__cplusplus) && !defined( PLAIN_API_ONLY )
#include <d2d1.h>
#include <dwrite.h>
#else
struct _ID2D1RenderTarget;
struct _ID2D1Factory;
struct _IDWriteFactory;
typedef struct _ID2D1RenderTarget ID2D1RenderTarget;
typedef struct _ID2D1Factory ID2D1Factory;
typedef struct _IDWriteFactory IDWriteFactory;
#endif*/
#if defined(_MSC_VER) && _MSC_VER < 1900
// Microsoft has finally implemented snprintf in Visual Studio 2015.
# define snprintf _snprintf_s
# define vsnprintf vsnprintf_s
#endif
#if __STDC_WANT_SECURE_LIB__
// use the safe version of `wcsncpy` if wanted
# define wcsncpy wcsncpy_s
#endif
#ifdef STATIC_LIB
void SciterInit( bool start);
#else
//#if defined(SCITER_EXPORTS)
// #define SCAPI __declspec(dllexport) __stdcall
//#else
// #define SCAPI __declspec(dllimport) __stdcall
//#endif
#endif
#define SCAPI __stdcall
#define SCFN(name) (__stdcall *name)
#define HWINDOW HWND
#define SC_CALLBACK __stdcall
typedef wchar_t wchar;
#ifdef _WIN64
#define TARGET_64
#else
#define TARGET_32
#endif
#elif defined(OSX)
//#ifdef __OBJC__
// #define char16_t uint16_t
//#endif
#ifndef BOOL
typedef signed char BOOL;
#endif
#ifndef TRUE
#define TRUE (1)
#define FALSE (0)
#endif
typedef unsigned int UINT;
typedef int INT;
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned char BYTE;
typedef char16_t WCHAR;
typedef const WCHAR* LPCWSTR;
typedef WCHAR* LPWSTR;
typedef char CHAR;
typedef const CHAR* LPCSTR;
typedef void VOID;
typedef size_t UINT_PTR;
typedef void* LPVOID;
typedef const void* LPCVOID;
#define SCAPI
#define SCFN(name) (*name)
#define SC_CALLBACK
#define CALLBACK
typedef struct tagRECT
{
INT left;
INT top;
INT right;
INT bottom;
} RECT, *LPRECT;
typedef const RECT * LPCRECT;
typedef struct tagPOINT
{
INT x;
INT y;
} POINT, *PPOINT, *LPPOINT;
typedef struct tagSIZE
{
INT cx;
INT cy;
} SIZE, *PSIZE, *LPSIZE;
#define HWINDOW void* // NSView*
#define HINSTANCE void* // NSApplication*
#define HDC void* // CGContextRef
#define LRESULT long
#ifdef __LP64__
#define TARGET_64
#define SCITER_DLL_NAME "sciter-osx-64.dylib"
#else
#define TARGET_32
#define SCITER_DLL_NAME "sciter-osx-32.dylib"
#endif
#elif defined(LINUX)
#include <gtk/gtk.h>
#include <string.h>
#include <wctype.h>
#ifndef BOOL
typedef signed char BOOL;
#endif
typedef unsigned int UINT;
typedef int INT;
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned char BYTE;
typedef char16_t WCHAR;
typedef const WCHAR* LPCWSTR;
typedef WCHAR* LPWSTR;
typedef char CHAR;
typedef const CHAR* LPCSTR;
typedef void VOID;
typedef size_t UINT_PTR;
typedef void* LPVOID;
typedef const void* LPCVOID;
#define SCAPI
#define SCFN(name) (*name)
#define SC_CALLBACK
typedef struct tagRECT
{
INT left;
INT top;
INT right;
INT bottom;
} RECT, *LPRECT;
typedef const RECT * LPCRECT;
typedef struct tagPOINT
{
INT x;
INT y;
} POINT, *PPOINT, *LPPOINT;
typedef struct tagSIZE
{
INT cx;
INT cy;
} SIZE, *PSIZE, *LPSIZE;
#define HWINDOW GtkWidget* //
#define HINSTANCE void* //
#define LRESULT long
#define HDC void* // cairo_t
#ifdef __x86_64
#define TARGET_64
#define SCITER_DLL_NAME "libsciter-gtk-64.so"
#else
#define TARGET_32
#define SCITER_DLL_NAME "libsciter-gtk-32.so"
#endif
#endif
#if !defined(OBSOLETE)
/* obsolete API marker*/
#if defined(__GNUC__)
#define OBSOLETE __attribute__((deprecated))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
#define OBSOLETE __declspec(deprecated)
#else
#define OBSOLETE
#endif
#endif
#ifndef LPUINT
typedef UINT* LPUINT;
#endif
#ifndef LPCBYTE
typedef const BYTE* LPCBYTE;
#endif
/**callback function used with various get*** functions */
typedef VOID SC_CALLBACK LPCWSTR_RECEIVER( LPCWSTR str, UINT str_length, LPVOID param );
typedef VOID SC_CALLBACK LPCSTR_RECEIVER( LPCSTR str, UINT str_length, LPVOID param );
typedef VOID SC_CALLBACK LPCBYTE_RECEIVER( LPCBYTE str, UINT num_bytes, LPVOID param );
#define STDCALL __stdcall
#ifdef __cplusplus
#define EXTERN_C extern "C"
namespace std {
typedef basic_string<WCHAR> ustring;
}
// Note: quote here is a string literal!
#ifdef WINDOWS
#define _WSTR(quote) L##quote
#else
#define _WSTR(quote) u##quote
#endif
#define WSTR(quote) ((const WCHAR*)_WSTR(quote))
#else
#define EXTERN_C extern
#endif /* __cplusplus **/
#endif