Mercurial > dwindows
annotate compat.h @ 97:24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 19 Jul 2002 14:17:02 +0000 |
parents | ab77a22a2a36 |
children | 02bbe1f397bb |
rev | line source |
---|---|
3 | 1 /* $Id$ */ |
2 | |
3 /* This header includes and defines everything needed for a given OS/compiler */ | |
4 #if !defined(__EMX__) && !defined(__IBMC__) && !defined(__WIN32__) && !defined(WINNT) | |
5 #include "config.h" | |
6 | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
7 #include <sys/stat.h> |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
8 #include <unistd.h> |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
9 void msleep(long period); |
3 | 10 #endif /* Unix */ |
11 | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
12 #ifndef __TARGET__ |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
13 #define __TARGET__ "dw" |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
14 #endif |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
15 |
3 | 16 #include <sys/types.h> |
17 #if HAVE_DIRENT_H | |
18 #include <dirent.h> | |
19 #define NAMLEN(dirent) strlen((dirent)->d_name) | |
20 #else | |
21 #define dirent direct | |
22 #define NAMLEN(dirent) (dirent)->d_namlen | |
23 #if HAVE_SYS_NDIR_H | |
24 #include <sys/ndir.h> | |
25 #endif /* HAVE_SYS_NDIR_H */ | |
26 #if HAVE_SYS_DIR_H | |
27 #include <sys/dir.h> | |
28 #endif /* HAVE_SYS_DIR_H */ | |
29 #if HAVE_NDIR_H | |
30 #include <ndir.h> | |
31 #endif /* HAVE_NDIR_H */ | |
32 #endif /* HAVE_DIRENT_H */ | |
33 | |
34 #ifdef DIRSEP | |
35 #undef DIRSEP | |
36 #endif | |
37 | |
38 #if defined(__EMX__) || defined(__IBMC__) || defined(__WIN32__) || defined(WINNT) | |
39 #include <io.h> | |
40 #include <process.h> | |
41 | |
42 #define DIRSEP "\\" | |
43 #define INIDIR "." | |
44 #define TYPDIR "." | |
45 #else | |
46 #define DIRSEP "/" | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
47 #define INIDIR "~/." __TARGET__ |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
48 #define TYPDIR "/usr/local/" __TARGET__ |
3 | 49 #endif |
50 | |
51 /* OS/2 */ | |
52 #if defined(__EMX__) || defined(__IBMC__) | |
53 #define INCL_WIN | |
54 #define INCL_GPI | |
55 #define INCL_VIO | |
56 #define INCL_NLS | |
57 #define INCL_DOS | |
58 #define INCL_DEV | |
59 #define INCL_DOSERRORS | |
60 | |
61 #define msleep(a) DosSleep(a) | |
62 | |
63 #ifdef __EMX__ | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
64 #include <dirent.h> |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
65 #include <sys/stat.h> |
28
cd715f9036c0
Added HAVE_PIPE define for EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
66 #define HAVE_PIPE |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
67 #ifdef FD_SETSIZE |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
68 #undef FD_SETSIZE |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
69 #endif |
3 | 70 #define FD_SETSIZE 1024 |
71 #define strcasecmp stricmp | |
72 #define strncasecmp strnicmp | |
73 #endif /* __EMX__ */ | |
74 | |
75 #ifndef OS2 | |
76 #define OS2 | |
77 #endif /* OS2 */ | |
78 | |
79 #include <os2.h> | |
80 | |
81 #ifndef BKS_TABBEDDIALOG | |
82 #define BKS_TABBEDDIALOG 0x0800 | |
83 #endif | |
84 | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
85 #define PIPENAME "\\socket\\" __TARGET__ "%d" |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
86 #define TPIPENAME "\\socket\\" __TARGET__ "%d" |
3 | 87 #else |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
88 #define PIPENAME "/tmp/" __TARGET__ "%d" |
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
89 #define TPIPENAME "/tmp/" __TARGET__ "%d" |
3 | 90 #endif /* __EMX__ || __IBMC__ */ |
91 | |
92 #ifdef __IBMC__ | |
93 #define BSD_SELECT | |
94 | |
95 #include <types.h> | |
96 #include <time.h> | |
97 #include <sys/stat.h> | |
98 #include <sys/select.h> | |
99 #include <sys/ioctl.h> | |
100 #include <direct.h> | |
101 #include <stdarg.h> | |
102 /* For VAC we are using the Mozilla dirent.c */ | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
103 #include "platform/dirent.h" |
3 | 104 #endif |
105 | |
106 /* Windows */ | |
107 #if defined(__WIN32__) || defined(WINNT) | |
108 #include <windows.h> | |
109 #include <winsock.h> | |
110 #include <time.h> | |
111 #include <process.h> | |
112 #include <sys/stat.h> | |
113 #ifdef MSVC | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
114 #include "platform/dirent.h" |
3 | 115 #else |
116 #include <dir.h> | |
117 #include <dirent.h> | |
118 #endif | |
119 #include <stdarg.h> | |
120 | |
121 #if defined(__CYGWIN32__) || defined(__MINGW32__) | |
122 #include <sys/un.h> | |
123 #endif /* __CYGWIN32__ || __MINGW32__ */ | |
124 | |
125 #ifndef __CYGWIN32__ | |
126 #define NO_DOMAIN_SOCKETS | |
127 #endif /* __CYGWIN32__ */ | |
128 | |
129 #if defined(_P_NOWAIT) && !defined(P_NOWAIT) | |
130 #define P_NOWAIT _P_NOWAIT | |
131 #endif | |
132 | |
133 #define strcasecmp stricmp | |
134 #define strncasecmp strnicmp | |
135 #define msleep Sleep | |
136 | |
137 #endif /* WIN32 */ | |
138 | |
139 /* Everything else ;) */ | |
140 #include <stdio.h> | |
141 #ifdef HAVE_UNISTD_H | |
142 #include <unistd.h> | |
143 #endif /* HAVE_UNISTD_H */ | |
144 #ifdef HAVE_SYS_STAT_H | |
145 #include <sys/stat.h> | |
146 #endif | |
147 #include <stdlib.h> | |
148 #include <stddef.h> | |
149 #include <signal.h> | |
150 #include <fcntl.h> | |
151 | |
152 #if !defined(__WIN32__) && !defined(WINNT) | |
153 #include <sys/time.h> | |
154 #include <sys/socket.h> | |
155 #include <sys/un.h> | |
156 #include <netinet/in.h> | |
157 #include <netdb.h> | |
158 #include <arpa/nameser.h> | |
159 #include <resolv.h> | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
160 #if defined(STDC_HEADERS) || defined(__EMX__) |
3 | 161 #include <stdarg.h> |
162 #include <string.h> | |
163 #endif /* STDC_HEADERS */ | |
164 #endif /* !WIN32 */ | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
165 #include <ctype.h> |
3 | 166 |
167 #ifndef _MAX_PATH | |
168 #define _MAX_PATH 255 | |
169 #endif | |
170 | |
171 /* IBM C doesn't allow "t" in the mode parameter | |
172 * because it violates the ANSI standard. | |
173 */ | |
174 #ifdef __IBMC__ | |
175 #define FOPEN_READ_TEXT "r" | |
176 #define FOPEN_WRITE_TEXT "w" | |
177 #define FOPEN_APPEND_TEXT "a" | |
178 #else | |
179 #define FOPEN_READ_TEXT "rt" | |
180 #define FOPEN_WRITE_TEXT "wt" | |
181 #define FOPEN_APPEND_TEXT "at" | |
182 #endif | |
183 #define FOPEN_READ_BINARY "rb" | |
184 #define FOPEN_WRITE_BINARY "wb" | |
185 #define FOPEN_APPEND_BINARY "ab" | |
186 | |
187 /* Compatibility layer for IBM C/Winsock */ | |
188 int sockread (int a, void *b, int c, int d); | |
189 int sockwrite (int a, void *b, int c, int d); | |
190 int sockclose(int a); | |
191 int socksprintf(int fd, char *format, ...); | |
192 int sockpipe(int *pipes); | |
193 void sockinit(void); | |
194 void sockshutdown(void); | |
195 int makedir(char *path); | |
196 void nonblock(int fd); | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
197 void block(int fd); |
53
8add9a616d0e
Added a log filename parameter to setfileinfo().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
41
diff
changeset
|
198 void setfileinfo(char *filename, char *url, char *logfile); |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
53
diff
changeset
|
199 #if (defined(__IBMC__) && __IBMC__ < 360) || (defined(__WIN32__) && !defined(__CYGWIN32__)) |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
28
diff
changeset
|
200 unsigned long drivesize(int drive); |
3 | 201 unsigned long drivefree(int drive); |
202 #else | |
203 unsigned long long drivefree(int drive); | |
36
cddb02f847e1
Added unix versions of functions in compat, and added getfsname, plus
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
28
diff
changeset
|
204 unsigned long long drivesize(int drive); |
3 | 205 #endif |
206 int isdrive(int drive); | |
41
af0a78aa0d45
More updates, and a more comprehensive unix install scheme. Use target
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
36
diff
changeset
|
207 void getfsname(int drive, char *buf, int len); |
3 | 208 FILE *fsopen(char *path, char *modes); |
209 int fsclose(FILE *fp); | |
210 char *fsgets(char *str, int size, FILE *stream); | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
211 int fsseek(FILE *stream, long offset, int whence); |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
212 int locale_init(char *filename, int my_locale); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
213 char *locale_string(char *default_text, int message); |
3 | 214 |