edac3ecdf06cd9086dbbf325cdd0845dfad93570
[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 #ifdef __hpux 
114 #   define __sysv
115 /* __hp9000s300 or __hp9000s800 is defined by HP-UX cpp */
116 #    if !defined (__hpux_8_0)
117 #       define __hp_7_0
118 #    endif
119 #    define __hp_nls_16
120 #    define __hp_color_object
121 #    define __unsigned_char_ptr_yytext
122 #endif  /* __hpux */
123
124 #ifdef __sun
125 #   if defined(sparc) && !defined(__sparc)
126 #      define __sparc
127 #   else
128 #      if defined(mc68000) || defined(__mc68000)
129 #         define __sun68k
130 #      endif
131 #   endif
132 #   define __hp_color_object  /* Should only be set if linking with    */
133                               /* HP's version of Motif (1.1 or later). */
134 #   define __char_ptr_yytext
135 #   define __c_callable         /* Set so VUE can link with libbms. */
136 #endif
137
138 #ifdef __apollo
139 #   ifndef __bsd
140 #       define __sysv   /* NOTE: not bsd!!! */
141 #   endif
142 #   ifndef __apollo_paths
143 #       define __apollo_paths
144 #   endif
145 #   ifndef __apollo_null
146 #       define __apollo_null
147 #   endif
148 #   if defined(a88k) && !defined(__apollo88k)
149 #      define __apollo88k
150 #   endif
151 #   if defined(_ISP__A88K) && !defined(__apollo88k)
152 #      define __apollo88k
153 #   endif
154 #   if defined(m68k) && !defined(__apollo68k)
155 #      define __apollo68k
156 #   endif
157 #   if defined(_ISP__M68K) && !defined(__apollo68k)
158 #      define __apollo68k
159 #   endif
160 #   define __hp_color_object
161 #   define __unsigned_char_ptr_yytext
162 #endif
163
164 #ifdef __aix
165 #       define __sysv
166 #endif
167
168 #if defined(__sysv) && !defined(SYSV)
169 #   define SYSV                         /* Needed for X11 include files */
170 #endif
171
172 #ifndef KEEP_DEADWOOD                   /* Setting this to "TRUE" will cause */
173 #   define  KEEP_DEADWOOD FALSE         /* all sorts of unknown problems.    */
174 #endif
175
176 #ifndef __apollo_paths
177 #   define __apollo_paths               /* We always want this feature */
178 #endif
179
180
181 #ifdef __cplusplus
182
183 #define UNUSED_PARM(_parm)
184
185 #else
186
187 #define UNUSED_PARM(_parm) _parm
188
189 #endif /* __cplusplus */
190
191 /* There are a few things that are not part of XPG3 that we need.    */
192 /* sockets are one of them.  To use this stuff, we just include the  */
193 /* non XOPEN include files and things work.  However, there are a    */
194 /* few XOPEN include files that have stuff to support this extra     */
195 /* functionality (e.g. sockets) that are #ifdef'ed for conditional   */
196 /* inclusion with the _XOPEN_SOURCE define.  In order to pull those  */
197 /* extra types in, we relas the XPG3 compliance for that file.  The  */
198 /* following are the three areas where we must do this:              */
199 /*                                                                   */
200 /* __need_timeval      gets "struct timeval"                         */
201 /* __need_fd_set       gets "typedef struct fd_set {..."             */
202 /* __need_S_IF         gets "S_IFNWK, S_IFLNK"                       */
203 /* __need_all_signals  gets all SIGxxx values                        */
204 /* __need_all_errors   gets all errno values                         */
205 /*                                                                   */
206 /* We get at these declarations differently on each platform...      */
207 /* ----------------------------------------------------------------- */
208
209 #if defined(__need_timeval)             /* Get "struct timeval" */
210 #   ifdef __sun
211 #      include <sys/time.h>
212 #   endif
213 #   ifdef __apollo
214 #      include <sys/time.h>
215 #   endif
216 #   ifdef __aix
217 #      include <sys/time.h>
218 #   endif
219 #endif /* __need_timeval */
220
221
222 #if defined(__need_fd_set)              /* Get "typedef struct fd_set" */
223 #   ifdef __apollo
224 #       define _INCLUDE_BSD_SOURCE
225 #       include "/bsd4.3/usr/include/sys/types.h"
226 #   endif
227 #   ifdef _AIX
228 #       include <sys/select.h>
229 #   endif
230 #endif /* __need_fd_st */
231
232
233 #if defined(__need_S_IF)                /* Get S_IFNWK, S_IFLNK */
234 #   ifdef __apollo
235 #      define _APOLLO_SOURCE
236 #   endif
237 #endif /* __need_S_IF */
238
239 #if defined(__need_all_errors)
240 #   ifdef __apollo
241 #      define _APOLLO_SOURCE
242 #      undef _SYS_STDSYMS_INCLUDED /* So we can include <sys/stdsyms.h> again */
243 #   endif
244 #endif
245
246 #if defined(__need_all_signals)         /* Get all SIGxxx values */
247 #   ifdef __apollo
248 #      define _APOLLO_SOURCE
249 #      include "/bsd4.3/usr/include/sys/types.h"
250 #   endif
251 #endif /* __need_all_signal */
252
253 /* We also use the following non XPG3 types.  However, they may be   */
254 /* defined when we relax the XPG3 compliance to get the stuff talked */
255 /* about above.  So, declare them only if we don't already have them */
256 /* ----------------------------------------------------------------- */
257
258 #if defined(_HPUX_SOURCE) || defined(__sun) || defined(_INCLUDE_BSD_SOURCE) || defined(__aix) || defined(linux)
259        /* the "u_types" are defined in standard files */
260 #      undef _INCLUDE_BSD_SOURCE
261 #else
262        typedef unsigned int   u_int;
263        typedef unsigned char  u_char;
264        typedef unsigned short u_short;
265        typedef unsigned long  u_long;
266 #endif
267
268 /* Use these if you must ensure that  you get a specific number of bits */
269 /* -------------------------------------------------------------------- */
270 typedef char  int8;
271 typedef short int16;
272 typedef long  int32;
273 typedef unsigned char  u_int8;
274 typedef unsigned short u_int16;
275 typedef unsigned long  u_int32;
276
277 #define __xechar_is_signed
278 #undef  __xechar_is_unsigned
279
280 #ifdef __xechar_is_signed
281 typedef char XeChar;
282 #else
283 typedef unsigned char XeChar;
284 #endif
285
286
287 /* The following type is a VARIABLE pointer to a VARIABLE XeChar. */
288
289 typedef XeChar *XeString;
290
291 /***********************************************************************
292 *       The following type is a VARIABLE pointer to a CONST XeChar.
293 *       Thus,   ConstXeString p;
294 *               p = "abcd"; #Legal
295 *               *p = "\0';  #Illegal
296 *
297 *       This is NOT the same as         (const XeString)
298 *       which is equivilent to          (XeChar * const)
299 *
300 *       Thus,   const XeString p;
301 *               p = "abcd"; #Illegal
302 *               *p = "\0';  #Legal
303 *
304 ************************************************************************/
305
306 typedef const XeChar *ConstXeString;
307
308 typedef unsigned short XeChar16;
309 typedef XeChar16 *XeString16;
310
311 #define XeString_NULL  (XeString) 0
312 #define XeString_Empty (XeString) ""
313 #define XeChar_NULL    (XeChar) 0
314
315 /* XtPointer was added in R4, so define it ourselves in R3 */
316 #ifdef __motif10
317 typedef void *  XtPointer;
318 #endif
319
320
321 /* The X11 R4 header file "Intrinsic.h" is internally inconsistent  */
322 /* with respect to XtAppAddInput. The third parameter ("condition") */
323 /* is defined to be of type XtPointer (void *), but the input masks */
324 /* commonly used with it are scalar values. Until the problem is    */
325 /* corrected by M.I.T, use the following type as a cast in calls    */
326 /* to XtAppAddInput. When it is corrected, change this typedef      */
327 /* accordingly.                                                     */
328 /* ---------------------------------------------------------------- */
329 typedef void * XeInputMask;
330
331 #ifdef __cplusplus
332 /* Define several macros to handle the C++ vs XtOffset problem.     */
333 /* The problem is that C++ cannot at compile time evaluate the      */
334 /* XtOffset macro within an initializer.  XtOffset is most often    */
335 /* used within an XtResource array initialization list.             */
336 /* class_names must be a typedef, non pointer type.                 */
337 /* ---------------------------------------------------------------- */
338
339 #define XtOffsetSimpleField(class_name,field) \
340           ((Cardinal) &class_name::field - 1)
341
342 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
343           (((Cardinal) &class_name1::field1 - 1) + ((Cardinal) &class_name2::field2 - 1))
344
345 #else
346 #define XtOffsetSimpleField(class_name,field) \
347         ((Cardinal) (((char *) (&(((class_name *)NULL)->field))) - ((char *) NULL)))
348
349 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
350         ((Cardinal) (((char *) (&(((class_name1 *)NULL)->field1))) - ((char *) NULL))) + \
351         ((Cardinal) (((char *) (&(((class_name2 *)NULL)->field2))) - ((char *) NULL)))
352 #endif
353
354 #ifndef __identification_strings
355 #define SUPPRESS_RCS_ID /*forces equivalent action for VED/EDIT shared files*/
356 #endif
357
358 #ifndef SBSTDINC_H_NO_INCLUDE
359 #include <bms/sbstdinc.h>
360 #endif
361
362 #ifdef __aix
363 #       undef  NULL
364 #       define NULL 0   /* AIX uses NULL=(void *)0 */
365 #endif
366
367 #endif /* PORT_H_INCLUDED */
368