2
0

sbport.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. #ifndef PORT_H_INCLUDED
  35. #define PORT_H_INCLUDED
  36. /*---------------------------------------------------------------------------
  37. The following is a list of #defines that may be tested for in the code:
  38. =======================================================================
  39. __STDC__ - Will be set for ANSI C compilers
  40. __cplusplus - Will be set for C++ compilers
  41. __STDCPP__ - Will be set for ANSI and C++ compilers
  42. __sun - Will be set for SUN systems
  43. __aix - Will be set for IBM (AIX) systems
  44. __sysv - Set when using SYSV semantics (e.g. HP, SUN)
  45. SYSV - Set when __sysv is set (needed for some X11 includes)
  46. __bsd - Set when using BSD semantics
  47. __hp_7_0 - For running on HP-UX 7.0
  48. __hp_nls_16 - Set if HP's 16 bit support is to be compiled in
  49. __hp_color_object - Set if HP's ColorObject extension is available in the Motif library
  50. __hp9000s300 - Set for S300 (and S400?) HP-UX machines
  51. __hp9000s800 - Set for S800 (PA-RISC) machines
  52. __sparc - Set for SUN sparc machines
  53. __sun68k - Set for SUN m68k machines
  54. __identification_strings - Set when RCS header strings are to be in code
  55. __recursive_includes - Set to have .h files #includes prerequisite files
  56. __char_ptr_yytext - Set if the lex/yacc variable yytext is defined
  57. to be of type char[].
  58. __unsigned_char_ptr_yytext - Set if the lex/yacc variable yytext is defined
  59. to be of type unsigned char[].
  60. KEEP_DEADWOOD - Currently set to "FALSE". If set to "TRUE",
  61. lots of old code and semantics will be enabled.
  62. ----------------------------------------------------------------------------*/
  63. /* First task is to make sure all of the defines that we use in the */
  64. /* code are properly set up. */
  65. /* ---------------------------------------------------------------- */
  66. #if !defined(sun)
  67. #if !defined(__STDCPP__) && (defined(__STDC__) || defined(__cplusplus))
  68. # define __STDCPP__
  69. #endif
  70. #endif
  71. #if defined(sun) && !defined(__sun)
  72. # define __sun
  73. #endif
  74. #if defined(_AIX) && !defined(__aix)
  75. # define __aix
  76. # define OSF_MOTIF_1_1_1
  77. # define OSF_BUG
  78. #endif
  79. #ifdef __sun
  80. # if defined(sparc) && !defined(__sparc)
  81. # define __sparc
  82. # else
  83. # if defined(mc68000) || defined(__mc68000)
  84. # define __sun68k
  85. # endif
  86. # endif
  87. # define __hp_color_object /* Should only be set if linking with */
  88. /* HP's version of Motif (1.1 or later). */
  89. # define __char_ptr_yytext
  90. # define __c_callable /* Set so VUE can link with libbms. */
  91. #endif
  92. #ifdef __aix
  93. # define __sysv
  94. #endif
  95. #if defined(__sysv) && !defined(SYSV)
  96. # define SYSV /* Needed for X11 include files */
  97. #endif
  98. #ifndef KEEP_DEADWOOD /* Setting this to "TRUE" will cause */
  99. # define KEEP_DEADWOOD FALSE /* all sorts of unknown problems. */
  100. #endif
  101. #ifdef __cplusplus
  102. #define UNUSED_PARM(_parm)
  103. #else
  104. #define UNUSED_PARM(_parm) _parm
  105. #endif /* __cplusplus */
  106. /* There are a few things that are not part of XPG3 that we need. */
  107. /* sockets are one of them. To use this stuff, we just include the */
  108. /* non XOPEN include files and things work. However, there are a */
  109. /* few XOPEN include files that have stuff to support this extra */
  110. /* functionality (e.g. sockets) that are #ifdef'ed for conditional */
  111. /* inclusion with the _XOPEN_SOURCE define. In order to pull those */
  112. /* extra types in, we relas the XPG3 compliance for that file. The */
  113. /* following are the three areas where we must do this: */
  114. /* */
  115. /* __need_timeval gets "struct timeval" */
  116. /* __need_fd_set gets "typedef struct fd_set {..." */
  117. /* __need_S_IF gets "S_IFNWK, S_IFLNK" */
  118. /* __need_all_signals gets all SIGxxx values */
  119. /* __need_all_errors gets all errno values */
  120. /* */
  121. /* We get at these declarations differently on each platform... */
  122. /* ----------------------------------------------------------------- */
  123. #if defined(__need_timeval) /* Get "struct timeval" */
  124. # if defined(__sun) || defined(__aix)
  125. # include <sys/time.h>
  126. # endif
  127. #endif /* __need_timeval */
  128. #if defined(__need_fd_set) /* Get "typedef struct fd_set" */
  129. # ifdef _AIX
  130. # include <sys/select.h>
  131. # endif
  132. #endif /* __need_fd_st */
  133. /* We also use the following non XPG3 types. However, they may be */
  134. /* defined when we relax the XPG3 compliance to get the stuff talked */
  135. /* about above. So, declare them only if we don't already have them */
  136. /* ----------------------------------------------------------------- */
  137. #if defined(__sun) || defined(_INCLUDE_BSD_SOURCE) || defined(__aix) || defined(__linux__)
  138. /* the "u_types" are defined in standard files */
  139. # undef _INCLUDE_BSD_SOURCE
  140. #else
  141. typedef unsigned int u_int;
  142. typedef unsigned char u_char;
  143. typedef unsigned short u_short;
  144. typedef unsigned long u_long;
  145. #endif
  146. /* Use these if you must ensure that you get a specific number of bits */
  147. /* -------------------------------------------------------------------- */
  148. typedef char int8;
  149. typedef short int16;
  150. typedef long int32;
  151. typedef unsigned char u_int8;
  152. typedef unsigned short u_int16;
  153. typedef unsigned long u_int32;
  154. #define __xechar_is_signed
  155. #undef __xechar_is_unsigned
  156. #ifdef __xechar_is_signed
  157. typedef char XeChar;
  158. #else
  159. typedef unsigned char XeChar;
  160. #endif
  161. /* The following type is a VARIABLE pointer to a VARIABLE XeChar. */
  162. typedef XeChar *XeString;
  163. /***********************************************************************
  164. * The following type is a VARIABLE pointer to a CONST XeChar.
  165. * Thus, ConstXeString p;
  166. * p = "abcd"; #Legal
  167. * *p = "\0'; #Illegal
  168. *
  169. * This is NOT the same as (const XeString)
  170. * which is equivilent to (XeChar * const)
  171. *
  172. * Thus, const XeString p;
  173. * p = "abcd"; #Illegal
  174. * *p = "\0'; #Legal
  175. *
  176. ************************************************************************/
  177. typedef const XeChar *ConstXeString;
  178. typedef unsigned short XeChar16;
  179. typedef XeChar16 *XeString16;
  180. #define XeString_NULL (XeString) 0
  181. #define XeString_Empty (XeString) ""
  182. #define XeChar_NULL (XeChar) 0
  183. /* XtPointer was added in R4, so define it ourselves in R3 */
  184. #ifdef __motif10
  185. typedef void * XtPointer;
  186. #endif
  187. /* The X11 R4 header file "Intrinsic.h" is internally inconsistent */
  188. /* with respect to XtAppAddInput. The third parameter ("condition") */
  189. /* is defined to be of type XtPointer (void *), but the input masks */
  190. /* commonly used with it are scalar values. Until the problem is */
  191. /* corrected by M.I.T, use the following type as a cast in calls */
  192. /* to XtAppAddInput. When it is corrected, change this typedef */
  193. /* accordingly. */
  194. /* ---------------------------------------------------------------- */
  195. typedef void * XeInputMask;
  196. #ifdef __cplusplus
  197. /* Define several macros to handle the C++ vs XtOffset problem. */
  198. /* The problem is that C++ cannot at compile time evaluate the */
  199. /* XtOffset macro within an initializer. XtOffset is most often */
  200. /* used within an XtResource array initialization list. */
  201. /* class_names must be a typedef, non pointer type. */
  202. /* ---------------------------------------------------------------- */
  203. #define XtOffsetSimpleField(class_name,field) \
  204. ((Cardinal) &class_name::field - 1)
  205. #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
  206. (((Cardinal) &class_name1::field1 - 1) + ((Cardinal) &class_name2::field2 - 1))
  207. #else
  208. #define XtOffsetSimpleField(class_name,field) \
  209. ((Cardinal) (((char *) (&(((class_name *)NULL)->field))) - ((char *) NULL)))
  210. #define XtOffsetCompoundField(class_name1,field1,class_name2,field2) \
  211. ((Cardinal) (((char *) (&(((class_name1 *)NULL)->field1))) - ((char *) NULL))) + \
  212. ((Cardinal) (((char *) (&(((class_name2 *)NULL)->field2))) - ((char *) NULL)))
  213. #endif
  214. #ifndef __identification_strings
  215. #define SUPPRESS_RCS_ID /*forces equivalent action for VED/EDIT shared files*/
  216. #endif
  217. #ifndef SBSTDINC_H_NO_INCLUDE
  218. #include <bms/sbstdinc.h>
  219. #endif
  220. #ifdef __aix
  221. # undef NULL
  222. # define NULL 0 /* AIX uses NULL=(void *)0 */
  223. #endif
  224. #endif /* PORT_H_INCLUDED */