2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
24 * File: sbport.h $TOG: sbport.h /main/4 1998/03/16 14:40:52 mgreess $
27 * (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
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. *
35 #ifndef PORT_H_INCLUDED
36 #define PORT_H_INCLUDED
38 /*---------------------------------------------------------------------------
40 The following is a list of #defines that may be tested for in the code:
41 =======================================================================
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
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
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
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
62 __sparc - Set for SUN sparc machines
63 __sun68k - Set for SUN m68k machines
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
70 __apollo_paths - Set to have "//<host>" converted to "host:"
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
76 __unsigned_char_ptr_yytext - Set if the lex/yacc variable yytext is defined
77 to be of type unsigned char[].
79 KEEP_DEADWOOD - Currently set to "FALSE". If set to "TRUE",
80 lots of old code and semantics will be enabled.
82 ----------------------------------------------------------------------------*/
86 /* First task is to make sure all of the defines that we use in the */
87 /* code are properly set up. */
88 /* ---------------------------------------------------------------- */
90 #if !defined(__STDCPP__) && (defined(__STDC__) || defined(__cplusplus))
95 #if defined(sun) && !defined(__sun)
99 #if defined(apollo) && !defined(__apollo)
103 #if defined(hpux) && !defined(__hpux)
107 #if defined(_AIX) && !defined(__aix)
109 # define OSF_MOTIF_1_1_1
113 #if defined(__osf__) && !defined(__osf)
117 # define __char_ptr_yytext
120 #if defined(osf) && !defined(__osf)
125 # define __hp_color_object
126 # define __char_ptr_yytext
131 /* __hp9000s300 or __hp9000s800 is defined by HP-UX cpp */
132 # if !defined (__hpux_8_0)
136 # define __hp_color_object
137 # define __unsigned_char_ptr_yytext
141 # if defined(sparc) && !defined(__sparc)
144 # if defined(mc68000) || defined(__mc68000)
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. */
156 # define __sysv /* NOTE: not bsd!!! */
158 # ifndef __apollo_paths
159 # define __apollo_paths
161 # ifndef __apollo_null
162 # define __apollo_null
164 # if defined(a88k) && !defined(__apollo88k)
167 # if defined(_ISP__A88K) && !defined(__apollo88k)
170 # if defined(m68k) && !defined(__apollo68k)
173 # if defined(_ISP__M68K) && !defined(__apollo68k)
176 # define __hp_color_object
177 # define __unsigned_char_ptr_yytext
184 #if defined(__sysv) && !defined(SYSV)
185 # define SYSV /* Needed for X11 include files */
188 #ifndef KEEP_DEADWOOD /* Setting this to "TRUE" will cause */
189 # define KEEP_DEADWOOD FALSE /* all sorts of unknown problems. */
192 #ifndef __apollo_paths
193 # define __apollo_paths /* We always want this feature */
199 #define UNUSED_PARM(_parm)
203 #define UNUSED_PARM(_parm) _parm
205 #endif /* __cplusplus */
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: */
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 */
222 /* We get at these declarations differently on each platform... */
223 /* ----------------------------------------------------------------- */
225 #if defined(__need_timeval) /* Get "struct timeval" */
228 # include <sys/time.h>
231 # include <sys/time.h>
234 # include <sys/time.h>
237 # include <sys/time.h>
240 # include <sys/time.h>
242 #endif /* __need_timeval */
245 #if defined(__need_fd_set) /* Get "typedef struct fd_set" */
248 # include <sys/types.h>
251 # define _INCLUDE_BSD_SOURCE
252 # include "/bsd4.3/usr/include/sys/types.h"
255 # include <sys/select.h>
259 # include <sys/select.h>
262 #endif /* __need_fd_st */
265 #if defined(__need_S_IF) /* Get S_IFNWK, S_IFLNK */
270 # define _APOLLO_SOURCE
272 #endif /* __need_S_IF */
274 #if defined(__need_all_errors)
276 # define _APOLLO_SOURCE
277 # undef _SYS_STDSYMS_INCLUDED /* So we can include <sys/stdsyms.h> again */
281 #if defined(__need_all_signals) /* Get all SIGxxx values */
286 # define _APOLLO_SOURCE
287 # include "/bsd4.3/usr/include/sys/types.h"
289 #endif /* __need_all_signal */
291 /* We also use the following non XPG3 types. However, they may be */
292 /* defined when we relax the XPG3 compliance to get the stuff talked */
293 /* about above. So, declare them only if we don't already have them */
294 /* ----------------------------------------------------------------- */
296 #if defined(_HPUX_SOURCE) || defined(__sun) || defined(USL) || defined(_INCLUDE_BSD_SOURCE) || defined(_OSF_SOURCE) || defined(__aix) || defined(__osf__) || defined(linux)
297 /* the "u_types" are defined in standard files */
298 # undef _INCLUDE_BSD_SOURCE
300 typedef unsigned int u_int;
301 typedef unsigned char u_char;
302 typedef unsigned short u_short;
303 typedef unsigned long u_long;
306 /* Use these if you must ensure that you get a specific number of bits */
307 /* -------------------------------------------------------------------- */
313 typedef unsigned char u_int8;
314 typedef unsigned short u_int16;
316 typedef unsigned long u_int32;
319 #define __xechar_is_signed
320 #undef __xechar_is_unsigned
322 #ifdef __xechar_is_signed
325 typedef unsigned char XeChar;
329 /* The following type is a VARIABLE pointer to a VARIABLE XeChar. */
331 typedef XeChar *XeString;
333 /***********************************************************************
334 * The following type is a VARIABLE pointer to a CONST XeChar.
335 * Thus, ConstXeString p;
337 * *p = "\0'; #Illegal
339 * This is NOT the same as (const XeString)
340 * which is equivilent to (XeChar * const)
342 * Thus, const XeString p;
343 * p = "abcd"; #Illegal
346 ************************************************************************/
348 typedef const XeChar *ConstXeString;
350 typedef unsigned short XeChar16;
351 typedef XeChar16 *XeString16;
353 #define XeString_NULL (XeString) 0
354 #define XeString_Empty (XeString) ""
355 #define XeChar_NULL (XeChar) 0
357 /* XtPointer was added in R4, so define it ourselves in R3 */
359 typedef void * XtPointer;
363 /* The X11 R4 header file "Intrinsic.h" is internally inconsistent */
364 /* with respect to XtAppAddInput. The third parameter ("condition") */
365 /* is defined to be of type XtPointer (void *), but the input masks */
366 /* commonly used with it are scalar values. Until the problem is */
367 /* corrected by M.I.T, use the following type as a cast in calls */
368 /* to XtAppAddInput. When it is corrected, change this typedef */
370 /* ---------------------------------------------------------------- */
371 typedef void * XeInputMask;
374 /* Define several macros to handle the C++ vs XtOffset problem. */
375 /* The problem is that C++ cannot at compile time evaluate the */
376 /* XtOffset macro within an initializer. XtOffset is most often */
377 /* used within an XtResource array initialization list. */
378 /* class_names must be a typedef, non pointer type. */
379 /* ---------------------------------------------------------------- */
381 #define XtOffsetSimpleField(class_name,field) \
382 ((Cardinal) &class_name::field - 1)
384 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
385 (((Cardinal) &class_name1::field1 - 1) + ((Cardinal) &class_name2::field2 - 1))
388 #define XtOffsetSimpleField(class_name,field) \
389 ((Cardinal) (((char *) (&(((class_name *)NULL)->field))) - ((char *) NULL)))
391 #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
392 ((Cardinal) (((char *) (&(((class_name1 *)NULL)->field1))) - ((char *) NULL))) + \
393 ((Cardinal) (((char *) (&(((class_name2 *)NULL)->field2))) - ((char *) NULL)))
396 #ifndef __identification_strings
397 #define SUPPRESS_RCS_ID /*forces equivalent action for VED/EDIT shared files*/
400 #ifndef SBSTDINC_H_NO_INCLUDE
401 #include <bms/sbstdinc.h>
406 # define NULL 0 /* AIX uses NULL=(void *)0 */
409 #endif /* PORT_H_INCLUDED */