Remove Unixware and openserver support
[oweals/cde.git] / cde / lib / DtSvc / include / bms / sbport.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * File:         sbport.h $TOG: sbport.h /main/4 1998/03/16 14:40:52 mgreess $
25  * Language:     C
26  *
27  * (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
28  *
29  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
30  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
31  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
32  * (c) Copyright 1993, 1994 Novell, Inc.                                *
33  */
34
35 #ifndef PORT_H_INCLUDED
36 #define PORT_H_INCLUDED
37
38 /*---------------------------------------------------------------------------
39
40   The following is a list of #defines that may be tested for in the code:
41   =======================================================================
42
43   __STDC__              - Will be set for ANSI C compilers
44   __cplusplus           - Will be set for C++ compilers
45   __STDCPP__            - Will be set for ANSI and C++ compilers
46
47  __hpux                 - Will be set for HP-UX systems
48  __sun                  - Will be set for SUN systems
49  __apollo               - Will be set for APOLLO (domain) systems
50  __aix                  - Will be set for IBM (AIX) systems
51
52   __sysv                - Set when using SYSV semantics (e.g. HP, SUN)
53   SYSV                  - Set when __sysv is set (needed for some X11 includes)
54   __bsd                 - Set when using BSD semantics
55
56  __hp_7_0               - For running on HP-UX 7.0 
57  __hp_nls_16            - Set if HP's 16 bit support is to be compiled in
58  __hp_color_object      - Set if HP's ColorObject extension is available in the Motif library
59  __hp9000s300           - Set for S300 (and S400?) HP-UX machines
60  __hp9000s800           - Set for S800 (PA-RISC) machines
61
62  __sparc                - Set for SUN sparc machines
63  __sun68k               - Set for SUN m68k machines
64
65
66  __apollo88k            - Set for apollo (domain) risc (PRISM) machines
67  __apollo68k            - Set for apollo (domain) m68k machines
68  __apollo_null          - Set to allow null pointer dereferences on domain
69
70  __apollo_paths         - Set to have "//<host>" converted to "host:" 
71
72  __identification_strings - Set when RCS header strings are to be in code
73  __recursive_includes   - Set to have .h files #includes prerequisite files
74  __char_ptr_yytext      - Set if the lex/yacc variable yytext is defined
75                           to be of type char[].
76  __unsigned_char_ptr_yytext - Set if the lex/yacc variable yytext is defined
77                               to be of type unsigned char[].
78
79  KEEP_DEADWOOD          - Currently set to "FALSE".  If set to "TRUE",
80                           lots of old code and semantics will be enabled.
81
82 ----------------------------------------------------------------------------*/
83
84
85
86 /* First task is to make sure all of the defines that we use in the */
87 /* code are properly set up.                                        */
88 /* ---------------------------------------------------------------- */
89 #if !defined(sun)
90 #if !defined(__STDCPP__) && (defined(__STDC__) || defined(__cplusplus))
91 #   define __STDCPP__
92 #endif
93 #endif
94
95 #if defined(sun) && !defined(__sun)
96 #   define __sun
97 #endif
98
99 #if defined(apollo) && !defined(__apollo)
100 #   define __apollo
101 #endif
102
103 #if defined(hpux) && !defined(__hpux)
104 #   define __hpux
105 #endif
106
107 #if defined(_AIX) && !defined(__aix)
108 #   define __aix
109 #   define OSF_MOTIF_1_1_1
110 #   define OSF_BUG
111 #endif
112
113 #if defined(__osf__) && !defined(__osf)
114 #   define __osf
115 #   define __sysv
116 #   define OSF_BUG
117 #   define __char_ptr_yytext
118 #endif
119
120 #if defined(osf) && !defined(__osf)
121 #   define __osf
122 #   define __sysv
123 #   define __osfs700
124 #   define OSF_BUG
125 #   define __hp_color_object
126 #   define __char_ptr_yytext
127 #endif
128
129 #ifdef __hpux 
130 #   define __sysv
131 /* __hp9000s300 or __hp9000s800 is defined by HP-UX cpp */
132 #    if !defined (__hpux_8_0)
133 #       define __hp_7_0
134 #    endif
135 #    define __hp_nls_16
136 #    define __hp_color_object
137 #    define __unsigned_char_ptr_yytext
138 #endif  /* __hpux */
139
140 #ifdef __sun
141 #   if defined(sparc) && !defined(__sparc)
142 #      define __sparc
143 #   else
144 #      if defined(mc68000) || defined(__mc68000)
145 #         define __sun68k
146 #      endif
147 #   endif
148 #   define __hp_color_object  /* Should only be set if linking with    */
149                               /* HP's version of Motif (1.1 or later). */
150 #   define __char_ptr_yytext
151 #   define __c_callable         /* Set so VUE can link with libbms. */
152 #endif
153
154 #ifdef __apollo
155 #   ifndef __bsd
156 #       define __sysv   /* NOTE: not bsd!!! */
157 #   endif
158 #   ifndef __apollo_paths
159 #       define __apollo_paths
160 #   endif
161 #   ifndef __apollo_null
162 #       define __apollo_null
163 #   endif
164 #   if defined(a88k) && !defined(__apollo88k)
165 #      define __apollo88k
166 #   endif
167 #   if defined(_ISP__A88K) && !defined(__apollo88k)
168 #      define __apollo88k
169 #   endif
170 #   if defined(m68k) && !defined(__apollo68k)
171 #      define __apollo68k
172 #   endif
173 #   if defined(_ISP__M68K) && !defined(__apollo68k)
174 #      define __apollo68k
175 #   endif
176 #   define __hp_color_object
177 #   define __unsigned_char_ptr_yytext
178 #endif
179
180 #ifdef __aix
181 #       define __sysv
182 #endif
183
184 #if defined(__sysv) && !defined(SYSV)
185 #   define SYSV                         /* Needed for X11 include files */
186 #endif
187
188 #ifndef KEEP_DEADWOOD                   /* Setting this to "TRUE" will cause */
189 #   define  KEEP_DEADWOOD FALSE         /* all sorts of unknown problems.    */
190 #endif
191
192 #ifndef __apollo_paths
193 #   define __apollo_paths               /* We always want this feature */
194 #endif
195
196
197 #ifdef __cplusplus
198
199 #define UNUSED_PARM(_parm)
200
201 #else
202
203 #define UNUSED_PARM(_parm) _parm
204
205 #endif /* __cplusplus */
206
207 /* There are a few things that are not part of XPG3 that we need.    */
208 /* sockets are one of them.  To use this stuff, we just include the  */
209 /* non XOPEN include files and things work.  However, there are a    */
210 /* few XOPEN include files that have stuff to support this extra     */
211 /* functionality (e.g. sockets) that are #ifdef'ed for conditional   */
212 /* inclusion with the _XOPEN_SOURCE define.  In order to pull those  */
213 /* extra types in, we relas the XPG3 compliance for that file.  The  */
214 /* following are the three areas where we must do this:              */
215 /*                                                                   */
216 /* __need_timeval      gets "struct timeval"                         */
217 /* __need_fd_set       gets "typedef struct fd_set {..."             */
218 /* __need_S_IF         gets "S_IFNWK, S_IFLNK"                       */
219 /* __need_all_signals  gets all SIGxxx values                        */
220 /* __need_all_errors   gets all errno values                         */
221 /*                                                                   */
222 /* We get at these declarations differently on each platform...      */
223 /* ----------------------------------------------------------------- */
224
225 #if defined(__need_timeval)             /* Get "struct timeval" */
226 #   ifdef __osf
227 #      define _OSF_SOURCE
228 #      include <sys/time.h>
229 #   endif
230 #   ifdef __sun
231 #      include <sys/time.h>
232 #   endif
233 #   ifdef __apollo
234 #      include <sys/time.h>
235 #   endif
236 #   ifdef __aix
237 #      include <sys/time.h>
238 #   endif
239 #endif /* __need_timeval */
240
241
242 #if defined(__need_fd_set)              /* Get "typedef struct fd_set" */
243 #   ifdef __osf
244 #      define _OSF_SOURCE
245 #      include <sys/types.h>
246 #   endif
247 #   ifdef __apollo
248 #       define _INCLUDE_BSD_SOURCE
249 #       include "/bsd4.3/usr/include/sys/types.h"
250 #   endif
251 #   ifdef _AIX
252 #       include <sys/select.h>
253 #   endif
254 #endif /* __need_fd_st */
255
256
257 #if defined(__need_S_IF)                /* Get S_IFNWK, S_IFLNK */
258 #   ifdef __osf
259 #      define _OSF_SOURCE
260 #   endif
261 #   ifdef __apollo
262 #      define _APOLLO_SOURCE
263 #   endif
264 #endif /* __need_S_IF */
265
266 #if defined(__need_all_errors)
267 #   ifdef __apollo
268 #      define _APOLLO_SOURCE
269 #      undef _SYS_STDSYMS_INCLUDED /* So we can include <sys/stdsyms.h> again */
270 #   endif
271 #endif
272
273 #if defined(__need_all_signals)         /* Get all SIGxxx values */
274 #   ifdef __osf
275 #      define _OSF_SOURCE
276 #   endif
277 #   ifdef __apollo
278 #      define _APOLLO_SOURCE
279 #      include "/bsd4.3/usr/include/sys/types.h"
280 #   endif
281 #endif /* __need_all_signal */
282
283 /* We also use the following non XPG3 types.  However, they may be   */
284 /* defined when we relax the XPG3 compliance to get the stuff talked */
285 /* about above.  So, declare them only if we don't already have them */
286 /* ----------------------------------------------------------------- */
287
288 #if defined(_HPUX_SOURCE) || defined(__sun) || defined(_INCLUDE_BSD_SOURCE) || defined(_OSF_SOURCE) || defined(__aix) || defined(__osf__) || defined(linux)
289        /* the "u_types" are defined in standard files */
290 #      undef _INCLUDE_BSD_SOURCE
291 #else
292        typedef unsigned int   u_int;
293        typedef unsigned char  u_char;
294        typedef unsigned short u_short;
295        typedef unsigned long  u_long;
296 #endif
297
298 /* Use these if you must ensure that  you get a specific number of bits */
299 /* -------------------------------------------------------------------- */
300 typedef char  int8;
301 typedef short int16;                    
302 #ifndef __osf__
303 typedef long  int32;
304 #endif
305 typedef unsigned char  u_int8;
306 typedef unsigned short u_int16;
307 #ifndef __osf__
308 typedef unsigned long  u_int32;
309 #endif
310
311 #define __xechar_is_signed
312 #undef  __xechar_is_unsigned
313
314 #ifdef __xechar_is_signed
315 typedef char XeChar;
316 #else
317 typedef unsigned char XeChar;
318 #endif
319
320
321 /* The following type is a VARIABLE pointer to a VARIABLE XeChar. */
322
323 typedef XeChar *XeString;
324
325 /***********************************************************************
326 *       The following type is a VARIABLE pointer to a CONST XeChar.
327 *       Thus,   ConstXeString p;
328 *               p = "abcd"; #Legal
329 *               *p = "\0';  #Illegal
330 *
331 *       This is NOT the same as         (const XeString)
332 *       which is equivilent to          (XeChar * const)
333 *
334 *       Thus,   const XeString p;
335 *               p = "abcd"; #Illegal
336 *               *p = "\0';  #Legal
337 *
338 ************************************************************************/
339
340 typedef const XeChar *ConstXeString;
341
342 typedef unsigned short XeChar16;
343 typedef XeChar16 *XeString16;
344
345 #define XeString_NULL  (XeString) 0
346 #define XeString_Empty (XeString) ""
347 #define XeChar_NULL    (XeChar) 0
348
349 /* XtPointer was added in R4, so define it ourselves in R3 */
350 #ifdef __motif10
351 typedef void *  XtPointer;
352 #endif
353
354
355 /* The X11 R4 header file "Intrinsic.h" is internally inconsistent  */
356 /* with respect to XtAppAddInput. The third parameter ("condition") */
357 /* is defined to be of type XtPointer (void *), but the input masks */
358 /* commonly used with it are scalar values. Until the problem is    */
359 /* corrected by M.I.T, use the following type as a cast in calls    */
360 /* to XtAppAddInput. When it is corrected, change this typedef      */
361 /* accordingly.                                                     */
362 /* ---------------------------------------------------------------- */
363 typedef void * XeInputMask;
364
365 #ifdef __cplusplus
366 /* Define several macros to handle the C++ vs XtOffset problem.     */
367 /* The problem is that C++ cannot at compile time evaluate the      */
368 /* XtOffset macro within an initializer.  XtOffset is most often    */
369 /* used within an XtResource array initialization list.             */
370 /* class_names must be a typedef, non pointer type.                 */
371 /* ---------------------------------------------------------------- */
372
373 #define XtOffsetSimpleField(class_name,field) \
374           ((Cardinal) &class_name::field - 1)
375
376 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
377           (((Cardinal) &class_name1::field1 - 1) + ((Cardinal) &class_name2::field2 - 1))
378
379 #else
380 #define XtOffsetSimpleField(class_name,field) \
381         ((Cardinal) (((char *) (&(((class_name *)NULL)->field))) - ((char *) NULL)))
382
383 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
384         ((Cardinal) (((char *) (&(((class_name1 *)NULL)->field1))) - ((char *) NULL))) + \
385         ((Cardinal) (((char *) (&(((class_name2 *)NULL)->field2))) - ((char *) NULL)))
386 #endif
387
388 #ifndef __identification_strings
389 #define SUPPRESS_RCS_ID /*forces equivalent action for VED/EDIT shared files*/
390 #endif
391
392 #ifndef SBSTDINC_H_NO_INCLUDE
393 #include <bms/sbstdinc.h>
394 #endif
395
396 #ifdef __aix
397 #       undef  NULL
398 #       define NULL 0   /* AIX uses NULL=(void *)0 */
399 #endif
400
401 #endif /* PORT_H_INCLUDED */
402