Fixes for compilation problems on Solaris(!).
[wxWidgets.git] / src / iodbc / config.h
1 #ifndef _CONFIG_H
2 #define _CONFIG_H
3
4 # if !defined(WINDOWS) && !defined(WIN32_SYSTEM) && !defined(OS2)
5 # define _UNIX_
6
7 # include <stdlib.h>
8 # include <sys/types.h>
9 # include <string.h>
10 # include <stdio.h>
11
12 # define MEM_ALLOC(size) (malloc((size_t)(size)))
13 # define MEM_FREE(ptr) {if(ptr) free(ptr);}
14
15 # define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
16 # define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
17 # define STRCAT(t, s) (strcat((char*)(t), (char*)(s)))
18 # define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n)))
19 # define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
20 # define STRLEN(str) ((str)? strlen((char*)(str)):0)
21
22 # define EXPORT
23 # define CALLBACK
24 # define FAR
25
26 typedef signed short SSHOR;
27 typedef short WORD;
28 typedef long DWORD;
29
30 typedef WORD WPARAM;
31 typedef DWORD LPARAM;
32 // KB: I don't see where HWND and BOOL could get defined before here,
33 // but putting in the #ifndef's solved the compilation problem on Solaris.
34 #ifndef HWND
35 typedef void* HWND;
36 #endif
37 #ifndef BOOL
38 typedef int BOOL;
39 #endif
40
41 # endif /* _UNIX_ */
42
43 # if defined(WINDOWS) || defined(WIN32_SYSTEM)
44
45 # include <windows.h>
46 # include <windowsx.h>
47
48 # ifdef _MSVC_
49 # define MEM_ALLOC(size) (fmalloc((size_t)(size)))
50 # define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0))
51 # define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s)))
52 # define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
53 # define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0)
54 # define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
55 # endif
56
57 # ifdef _BORLAND_
58 # define MEM_ALLOC(size) (farmalloc((unsigned long)(size))
59 # define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0)
60 # define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
61 # define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
62 # define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0)
63 # define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
64 # endif
65
66 # endif /* WINDOWS */
67
68 # if defined(OS2)
69
70 # include <stdlib.h>
71 # include <stdio.h>
72 # include <string.h>
73 # include <memory.h>
74 # define INCL_DOSMODULEMGR /* Module Manager values */
75 # define INCL_DOSERRORS /* Error values */
76 # include <os2.h>
77
78 # ifndef FAR
79 # define FAR
80 # endif
81
82 # define MEM_ALLOC(size) (malloc((size_t)(size)))
83 # define MEM_FREE(ptr) (free((ptr)))
84 # define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
85 # define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
86 # define STRCAT(t, s) (strcat((char*)(t), (char*)(s)))
87 # define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n)))
88 # define STRLEN(str) ((str)? strlen((char*)(str)):0)
89 # define STREQ(a, b) (0 == strcmp((char *)(a), (char *)(b)))
90
91 typedef signed short SSHOR;
92 typedef short WORD;
93 typedef long DWORD;
94
95 typedef WORD WPARAM;
96 typedef DWORD LPARAM;
97
98 # endif /* OS2 */
99
100 # define SYSERR (-1)
101
102 # ifndef NULL
103 # define NULL ((void FAR*)0UL)
104 # endif
105
106 #endif