1 /* $Id: datatype.h 2510 2008-03-02 17:07:33Z kuhlmann $ */
2 
3 #ifndef CLIMM_DATATYPE_H
4 #define CLIMM_DATATYPE_H
5 
6 #if HAVE_UNISTD_H
7    #include <unistd.h>
8 #endif
9 
10 #ifdef HAVE_WINDEF_H
11 #include <windef.h>
12 #endif
13 
14 #if !HAVE_BOOL
15 typedef unsigned char BOOL;
16 #endif
17 
18 #if !HAVE_UDWORD
19 typedef unsigned SIZE_4_TYPE UDWORD;
20 #endif
21 #if !HAVE_UWORD
22 typedef unsigned SIZE_2_TYPE UWORD;
23 #endif
24 #if !HAVE_UBYTE
25 typedef unsigned SIZE_1_TYPE UBYTE;
26 #endif
27 
UD2UL(UDWORD i)28 static inline unsigned long int UD2UL (UDWORD i) { return (unsigned long int) i; };
29 
30 #if !HAVE_SOCKLEN_T
31 typedef int socklen_t;
32 #endif
33 
34 #if !HAVE_WCHAR_T
35 typedef UDWORD wchar_t;
36 #endif
37 
38 #if !HAVE_ATOLL
39 #define atoll atoi
40 #endif
41 
42 #if !HAVE_ISWALNUM
43 #define iswalnum(ucs) (!(ucs & 0xffffff00L) && isalnum (ucs))
44 #endif
45 
46 #if !HAVE_ISWSPACE
47 #define iswspace(ucs) (!(ucs & 0xffffff00L) && iswspace (ucs))
48 #endif
49 
50 #define val_t UDWORD
51 
52 #if !ENABLE_FALLBACK_TRANSLIT
53 #define ENABLE_TRANSLIT 1
54 #endif
55 
56 typedef signed   SIZE_1_TYPE SBYTE;
57 typedef signed   SIZE_4_TYPE SDWORD;
58 
59 typedef int FD_T;
60 typedef int SOK_T;
61 
62 #ifdef _WIN32
63   #define sockread(s,p,l)  recv (s, (char *) p, l, 0)
64   #define sockwrite(s,p,l) send (s, (char *) p, l, 0)
65   #define sockclose(s)     closesocket(s)
66 
67   #define strcasecmp(s,s1)     stricmp (s, s1)
68   #define strncasecmp(s,s1,l)  strnicmp (s, s1, l)
69   #define __os_has_input kbhit()
70 
71   #define mkdir(a,b) mkdir(a)
72   #define INPUT_BY_POLL 1
73   #define INPUT_BY_GETCH 1
74   #define _OS_PREFPATH   ".\\"
75   #define _OS_PATHSEP    '\\'
76   #define _OS_PATHSEPSTR "\\"
77 
78 #elif defined(__BEOS__)
79   #define sockread(s,p,l)  recv (s, p, l, 0)
80   #define sockwrite(s,p,l) send (s, p, l, 0)
81   #define sockclose(s)     closesocket (s)
82   #define __os_has_input 1
83   #define INPUT_BY_POLL 1
84   #undef  INPUT_BY_GETCH
85   #define _OS_PREFPATH   NULL
86   #define _OS_PATHSEP    '/'
87   #define _OS_PATHSEPSTR "/"
88 
89 #elif defined(__amigaos__)
90   #define sockread(s,p,l)  read (s, p, l)
91   #define sockwrite(s,p,l) write (s, p, l)
92   #define sockclose(s)     close (s)
93   #undef INPUT_BY_POLL
94   #undef INPUT_BY_GETCH
95   #define __os_has_input UtilIOSelectIs (STDIN_FILENO, READFDS)
96   #define _OS_PREFPATH   "/PROGDIR/"
97   #define _OS_PATHSEP    '/'
98   #define _OS_PATHSEPSTR "/"
99 
100 #else
101   #define sockread(s,p,l)  read (s, p, l)
102   #define sockwrite(s,p,l) write (s, p, l)
103   #define sockclose(s)     close (s)
104   #undef INPUT_BY_POLL
105   #undef INPUT_BY_GETCH
106   #define __os_has_input UtilIOSelectIs (STDIN_FILENO, READFDS)
107   #define _OS_PREFPATH   NULL
108   #define _OS_PATHSEP    '/'
109   #define _OS_PATHSEPSTR "/"
110 
111 #endif
112 
113 #ifndef TRUE
114   #define TRUE 1
115 #endif
116 
117 #ifndef FALSE
118   #define FALSE 0
119 #endif
120 
121 #define RET_FAIL  0
122 #define RET_OK    1
123 #define RET_DEFER 2
124 #define RET_INPR  3
125 
126 #define RET_IS_OK(x) ((x) & 1)
127 
128 #define STR_DOT        "\xc2\xb7"
129 
130 #endif /* CLIMM_DATATYPE_H */
131