DCL 4.0
Loading...
Searching...
No Matches
Config.h
Go to the documentation of this file.
1#ifndef __DCL_CONFIG_H__
2#define __DCL_CONFIG_H__ 20110105
3
4/*****************************************************
5 OPERATING SYSTEM CONFIG
6*****************************************************/
7
8#if defined(_WIN32) || defined(_WIN64)
9 #ifndef _WIN32_WINNT
10 #define _WIN32_WINNT 0x0600
11 #endif
12 #define __DCL_WINDOWS 1
13 #define __DCL_UNIX 0
14 #define __DCL_PTHREAD 0
15 #define __DCL_USE_OPENSSL 0
16 #define __DCL_USE_SCHANNEL 1
17#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(linux)
18 #define __DCL_WINDOWS 0
19 #define __DCL_UNIX 1
20 #define __DCL_PTHREAD 1
21 #define __DCL_USE_OPENSSL 1
22 #define __DCL_USE_SCHANNEL 0
23#else
24 #error "Not Supported OS!"
25#endif
26
27#if defined(_DEBUG) || defined(__DCL_DEBUG)
28 #undef __DCL_DEBUG
29 #define __DCL_DEBUG 1
30#endif
31
32/*****************************************************
33 COMPILE CONFIG
34*****************************************************/
35
36/*
37 * MSC로 Static Library 에서 최적화 하면 LibMain::__LibInitializer 코드가 생성되지 않는다
38 * 2011-04-26
39 */
40#define __DCL_HAVE_MANUAL_INITIALIZE 1
41
42#if __DCL_DEBUG
43 #define __DCL_HAVE_THIS_FILE__ 1
44 #define __DCL_HAVE_ALLOC_DEBUG 1 /* core/Object.h */
45 #define __DCL_HAVE_STRING_ALLOC_DEBUG 0 /* core/String.cpp:1039 */
46#endif
47
48#define __DCL_HAVE_NAMESPACE 1
49#define __DCL_HAVE_THROWS_SPEC 0
50
51#if __DCL_DEBUG
52 /* 디버그 버전에서 AssertError*가 throw 될 수 있다. GCC에서
53 예외의 type이 cast되어 catch되지 못한다. */
54 #undef __DCL_HAVE_THROWS_SPEC
55 #define __DCL_HAVE_THROWS_SPEC 0
56#endif
57
58#if __DCL_WINDOWS
59 #ifdef _DLL
60 #ifdef __DCL_CORE_EXPORTS
61 #define DCLCAPI __declspec(dllexport)
62 #define DCLCVAR __declspec(dllexport)
63 #define __DCL_NET_EXPORTS
64 #else
65 #define DCLCAPI __declspec(dllimport)
66 #define DCLCVAR __declspec(dllimport)
67
68 #ifdef _MSC_VER
69 #if defined(_DEBUG)
70 #pragma comment(lib, "DCLCoredd.lib")
71 #elif defined(__DCL_DEBUG)
72 #pragma comment(lib, "DCLCored.lib")
73 #else
74 #pragma comment(lib, "DCLCore.lib")
75 #endif
76 #endif
77 #endif
78
79 #ifdef __DCL_EXT_EXPORTS
80 #define DCLEAPI __declspec(dllexport)
81 #define DCLEVAR __declspec(dllexport)
82 #else
83 #define DCLEAPI __declspec(dllimport)
84 #define DCLEVAR __declspec(dllimport)
85 #endif
86 #else
87 #define DCLCAPI
88 #define DCLCVAR
89 #define DCLEAPI
90 #define DCLEVAR
91 #endif
92
93 #define DCL_DSO_EXPORT __declspec(dllexport)
94#else
95 #ifdef __DCL_CORE_EXPORTS
96 #define DCLCAPI __attribute__ ((visibility("default")))
97 #define DCLCVAR __attribute__ ((visibility("default")))
98 #define __DCL_NET_EXPORTS
99 #else
100 #define DCLCAPI
101 #define DCLCVAR
102 #endif
103 #ifdef __DCL_EXT_EXPORTS
104 #define DCLEAPI __attribute__ ((visibility("default")))
105 #define DCLEVAR __attribute__ ((visibility("default")))
106 #else
107 #define DCLEAPI
108 #define DCLEVAR
109 #endif
110
111 #define DCL_DSO_EXPORT __attribute__ ((visibility("default")))
112 #define __DCL_REENTRANT
113#endif
114
115/**********************************/
116
117#ifdef __cplusplus
118 /*****************************************************
119 NAMESPACE CONFIG
120 *****************************************************/
121 #if __DCL_HAVE_NAMESPACE
122 #if __DCL_DEBUG
123 namespace DCLd {}
124 #define __DCL_NAMESPACE_STRING L"DCLd::"
125 #define __DCL_NAMESPACE DCLd::
126 #define __DCL_USING_NAMESPACE using namespace DCLd;
127 #define __DCL_BEGIN_NAMESPACE namespace DCLd {
128 #define __DCL_END_NAMESPACE }
129 #else
130 namespace DCL { } /* dummy declaration */
131 #define __DCL_NAMESPACE_STRING L"DCL::"
132 #define __DCL_NAMESPACE DCL::
133 #define __DCL_USING_NAMESPACE using namespace DCL;
134 #define __DCL_BEGIN_NAMESPACE namespace DCL {
135 #define __DCL_END_NAMESPACE }
136 #endif
137 #else
138 #define __DCL_NAMESPACE_STRING
139 #define __DCL_NAMESPACE
140 #define __DCL_USING_NAMESPACE
141 #define __DCL_BEGIN_NAMESPACE
142 #define __DCL_END_NAMESPACE
143 #endif
144
145 /*****************************************************
146 EXCEPTION SPECIFICATION CONFIG
147 *****************************************************/
148 #if __DCL_HAVE_THROWS_SPEC
149
150 #define __DCL_THROWS0 throw()
151 #define __DCL_THROWS1(e) throw(e)
152 #define __DCL_THROWS2(e1, e2) throw(e1, e2)
153 #define __DCL_THROWS3(e1, e2, e3) throw(e1, e2, e3)
154
155 /* MSVC C++ Exception Specification ignored */
156 #ifdef _MSC_VER
157 #pragma warning( disable : 4290 )
158 #endif
159 #else /* __DCL_HAVE_THROWS_SPEC */
160 #define __DCL_THROWS
161 #define __DCL_THROWS1(e)
162 #define __DCL_THROWS2(e1, e2)
163 #define __DCL_THROWS3(e1, e2, e3)
164 #endif
165#else /* __cplusplus */
166 #define __DCL_THROWS
167 #define __DCL_THROWS1(e)
168 #define __DCL_THROWS2(e1, e2)
169 #define __DCL_THROWS3(e1, e2, e3)
170#endif /* __cplusplus */
171
172
173/*****************************************************
174 BASIC TYPE DEFINITION
175*****************************************************/
176#ifdef __GNUC__
177 #ifndef __STDC_VERSION__
178 #define __STDC_VERSION__ 199901L
179 #endif
180#endif
181
182/* need size_t, ssize_t */
183#include <stddef.h>
184#include <sys/types.h>
185
186#ifdef _SSIZE_T_DEFINED
187 /* MinGW */
188 #define __ssize_t_defined
189#endif
190
191#ifndef __ssize_t_defined
192 #ifdef __GNUC__
193 typedef __ssize_t ssize_t;
194 #elif defined(_WIN64)
195 typedef __int64 ssize_t;
196 #elif defined(_WIN32)
197 typedef __int32 ssize_t;
198 #endif
199 #define __ssize_t_defined
200#endif
201
202#ifdef __GNUC__
203 typedef int errno_t;
204 #define __errno_t_defined
205#endif
206#ifdef _MSC_VER
207 #if _MSC_VER <= 1200
208 typedef int errno_t;
209 #endif
210 #define __errno_t_defined
211#endif
212
213/* Compiler predefined macro */
214#ifndef __TIMESTAMP__
215 #define __TIMESTAMP__ __DATE__ " " __TIME__
216#endif
217
218#if __DCL_WINDOWS && !defined(PATH_MAX)
219 /* _MSC_VER 에서 _POSIX_가 !defined 이면 PATH_MAX가 포함되지 않는다. */
220 #ifdef _MAX_PATH
221 #define PATH_MAX _MAX_PATH
222 #elif defined(MAX_PATH)
223 #define PATH_MAX MAX_PATH
224 #else
225 #define PATH_MAX 1024
226 #endif
227#endif
228
229#ifndef __WORDSIZE
230 /* linux bits/wordsize.h */
231 #if defined(_WIN64)
232 #define __WORDSIZE 64
233 #elif defined(_WIN32)
234 #define __WORDSIZE 32
235 #else
236 #error "Unknown marchine wordsize!"
237 #endif
238#endif
239
240#ifndef __BYTE_ORDER
241 #define __LITTLE_ENDIAN 1234
242 #define __BIG_ENDIAN 4321
243 #if defined(_M_ALPHA) || defined(_M_IX86) || defined(_M_X64)
244 #define __BYTE_ORDER __LITTLE_ENDIAN
245 #endif
246 #ifdef _M_IA64
247 #define __BYTE_ORDER __BIG_ENDIAN
248 #endif
249#endif
250
251#include <stdint.h>
252
253#ifndef __SIZEOF_WCHAR_T__
254 #if WCHAR_MAX == 0xffff
255 // wchar_t == unsigned short
256 // wint_t == unsigned int
257 #define __SIZEOF_WCHAR_T__ 2
258 #else
259 #define __SIZEOF_WCHAR_T__ 4
260 #endif
261#endif
262
263//#if __DCL_WINDOWS
264// typedef __int8 int8_t;
265// typedef __int16 int16_t;
266// typedef __int32 int32_t;
267// typedef __int64 int64_t;
268// typedef unsigned __int8 uint8_t;
269// typedef unsigned __int16 uint16_t;
270// typedef unsigned __int32 uint32_t;
271// typedef unsigned __int64 uint64_t;
272//#endif
273
274typedef unsigned char byte_t;
275typedef wchar_t char_t;
276
277/* limits */
278#undef INT8_MIN
279#undef INT16_MIN
280#undef INT32_MIN
281#undef INT64_MIN
282
283#undef INT8_MAX
284#undef INT16_MAX
285#undef INT32_MAX
286#undef INT64_MAX
287
288#undef UINT8_MAX
289#undef UINT16_MAX
290#undef UINT32_MAX
291#undef UINT64_MAX
292
293#include <limits.h>
294
295#ifdef _MSC_VER
296 #define INT8_MIN _I8_MIN
297 #define INT16_MIN _I16_MIN
298 #define INT32_MIN _I32_MIN
299 #define INT64_MIN _I64_MIN
300
301 #define INT8_MAX _I8_MAX
302 #define INT16_MAX _I16_MAX
303 #define INT32_MAX _I32_MAX
304 #define INT64_MAX _I64_MAX
305
306 #define UINT8_MAX _UI8_MAX
307 #define UINT16_MAX _UI16_MAX
308 #define UINT32_MAX _UI32_MAX
309 #define UINT64_MAX _UI64_MAX
310#else /* __GNUC__ */
311 #define INT8_MIN SCHAR_MIN
312 #define INT16_MIN SHRT_MIN
313 #define INT32_MIN INT_MIN
314 #define INT64_MIN LLONG_MIN
315
316 #define INT8_MAX SCHAR_MAX
317 #define INT16_MAX SHRT_MAX
318 #define INT32_MAX INT_MAX
319 #define INT64_MAX LLONG_MAX
320
321 #define UINT8_MAX UCHAR_MAX
322 #define UINT16_MAX USHRT_MAX
323 #define UINT32_MAX UINT_MAX
324 #define UINT64_MAX ULLONG_MAX
325#endif
326
327#ifdef __GNUC__
328 #undef BOOL
329 #undef TRUE
330 #undef FALSE
331 typedef int BOOL;
332 #define FALSE 0
333 #define TRUE !FALSE
334#endif
335
336#ifndef NULL
337 #ifdef __cplusplus
338 #define NULL 0
339 #else
340 #define NULL (void*)0
341 #endif
342#endif
343
344/*****************************************************
345 COMMENTS DEFINATIONS
346*****************************************************/
347
348#undef _CONST
349#undef _PRIVATE
350#undef __PROTECTED
351#undef _PUBLIC
352
353#define _CONST
354#define _PRIVATE public
355#define __PROTECTED public
356#define _PUBLIC
357#define __protected public
358
359/* close() 에서 참조된 객체를 close하지 않는다 */
360#define __noclose__
361
362/* close() 에서 포인터로 넘겨받은 객체를 close하고 destroy 한다 */
363#define __destroy__
364
365#define __countof(array, type) (sizeof(array) / sizeof(type))
366
367/*****************************************************
368 DCL VERSION INFORMATION
369*****************************************************/
370
371#define DCL_MAKE_VERSION(uMajor, uMinor) ((uint32_t)((uMajor << 16) | uMinor))
372#define DCL_MAJOR_VERSION(uVersion) ((unsigned int)(uVersion >> 16))
373#define DCL_MINOR_VERSION(uVersion) ((unsigned int)(uVersion & 0x0000ffff))
374
375/* DCL Library Version */
376#define DCL_VERSION DCL_MAKE_VERSION(4, 0)
377#define DCL_CORE_VERSION DCL_MAKE_VERSION(4, 0)
378#define DCL_EXT_VERSION DCL_MAKE_VERSION(1, 0)
379
380/* DCL SQL Interface Version */
381#define DCL_SQL_VERSION DCL_MAKE_VERSION(3, 2)
382
383/* DCL Http Server Environment/Extension Version */
384#define DCL_HTTP_SERVER_VERSION DCL_MAKE_VERSION(3, 2)
385
386/* uModuleType */
387#define DCL_CORE_LIB 1
388#define DCL_NET_LIB 2
389#define DCL_EXT_LIB 3
390#define DCL_SQL_DRIVER_MODULE 11
391#define DCL_HTTP_SERVLET_MODULE 21
392
393#define DCL_DSO_ENTRY_POINT DCLDSOEntryPoint
394#define DCL_DSO_ENTRY_POINT_STRING "DCLDSOEntryPoint"
395
396#if __DCL_DEBUG
397 #define DCL_BUILD_FLAG 1
398#else
399 #define DCL_BUILD_FLAG 0
400#endif
401
402/*
403 DCL DSO Module Entry Example
404
405typedef struct
406{
407 // DCL common members
408 uint32_t uSize; // size of this structure
409 uint32_t uDCLVersion; // DCL_VERSION
410 uint32_t uBuldFlag; // release(0), debug(1)
411 uint32_t uModuleType; //
412 const wchar_t* pszDescription; // module description
413
414 // application private members
415 uint32_t uVersion; // module application version
416 ...
417} MODULE_SPEC
418
419extern "C" {
420DCL_DSO_EXPORT
421MODULE_SPEC DCL_DSO_ENTRY_POINT =
422{
423 sizeof(MODULE_SPEC),
424 DCL_VERSION,
425 DCL_BUILD_FLAG,
426 DCL_SQL_DRIVER_MODULE, // if module is database driver
427 L"simple description",
428 DCL_SQL_VERSION,
429 ...
430};
431}
432
433*/
434
435typedef struct __DCL_LIBRARY_MODULE
436{
437 uint32_t uSize; /* size of this structure */
438 uint32_t uDCLVersion; /* DCL_VERSION */
439 const char* pszBuildTimeStamp; /* __TIMESTAMP__ */
440 uint32_t uBuldFlag; /* release(0), debug(1) */
441 uint32_t uModuleType; /* DCL_CORE_LIB, ... */
442 const char* pszDescription; /* module description */
443
445
446#define DCL_WIN_REG_BASE L"Software\\Daejung Kim\\DCL"
447
448#endif /* __DCL_CONFIG_H__ */
#define __int64
Definition __xtoa.cpp:15
#define __int32
Definition __xtoa.cpp:11
wchar_t char_t
Definition Config.h:275
unsigned char byte_t
Definition Config.h:274
struct __DCL_LIBRARY_MODULE DCL_LIBRARY_MODULE
int BOOL
const char * pszDescription
Definition Config.h:442
uint32_t uDCLVersion
Definition Config.h:438
const char * pszBuildTimeStamp
Definition Config.h:439
uint32_t uModuleType
Definition Config.h:441
uint32_t uBuldFlag
Definition Config.h:440