~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/3rdparty/qmon/Xmt310/Xmt/Xmt.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Motif Tools Library, Version 3.1
 
3
 * $Id$
 
4
 * 
 
5
 * Written by David Flanagan.
 
6
 * Copyright (c) 1992-2001 by David Flanagan.
 
7
 * All Rights Reserved.  See the file COPYRIGHT for details.
 
8
 * This is open source software.  See the file LICENSE for details.
 
9
 * There is no warranty for this software.  See NO_WARRANTY for details.
 
10
 *
 
11
 * $Log$
 
12
 * Revision 1.1.1.1  2001/07/18 11:06:03  root
 
13
 * Initial checkin.
 
14
 *
 
15
 * Revision 1.2  2001/06/12 16:25:28  andre
 
16
 * *** empty log message ***
 
17
 *
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef _Xmt_h
 
22
#define _Xmt_h
 
23
 
 
24
/*
 
25
 * This header will contain whatever #ifdefs and #includes are needed to
 
26
 * make the Xmt library portable on as many platforms as possible
 
27
 */
 
28
 
 
29
#if !defined (XMT_HAS_STRERROR)
 
30
# if defined (XMT_HAS_SYS_ERRLIST)
 
31
extern char *sys_errlist[];
 
32
#   define strerror(err) sys_errlist[err]
 
33
# else
 
34
#   define strerror(err) "strerror is unsupported"
 
35
# endif /* XMT_HAS_SYS_ERRLIST */
 
36
#endif /* !XMT_HAS_STERROR */
 
37
 
 
38
/*
 
39
 * Standard X header files
 
40
 */
 
41
#include <X11/Intrinsic.h>
 
42
#include <X11/StringDefs.h>
 
43
 
 
44
/*
 
45
 * If the compiler can't handle prototypes, tell the Motif headers so
 
46
 */
 
47
#if NeedFunctionPrototypes == 0
 
48
#ifndef _NO_PROTO
 
49
#define _NO_PROTO
 
50
#endif
 
51
#endif
 
52
 
 
53
/*
 
54
 * The standard Motif header file
 
55
 */
 
56
#include <Xm/Xm.h>
 
57
 
 
58
/*
 
59
 * Specify what version of Xmt this is.
 
60
 */
 
61
#define XmtVERSION      3
 
62
#define XmtREVISION     1
 
63
#define XmtVersion      (XmtVERSION * 1000 + XmtREVISION)
 
64
#define XmtPatchlevel   0
 
65
 
 
66
/*
 
67
 * figure out what version of Xt we're using.
 
68
 */
 
69
#if defined(XtSpecificationRelease)
 
70
#  define X11R4
 
71
#else
 
72
#  undef X11R4
 
73
#endif
 
74
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
 
75
#  define X11R5
 
76
#else
 
77
#  undef X11R5
 
78
#endif
 
79
 
 
80
/* 
 
81
 * There were some useful Xrm functions, etc. added in R5.
 
82
 * Pre-R5, they can be approximated as follows:
 
83
 */
 
84
#ifndef X11R5
 
85
#  define XrmGetDatabase(dpy) ((dpy)->db)
 
86
#  define XrmSetDatabase(dpy, database) ((dpy)->db = (database))
 
87
#  define XtScreenDatabase(screen) XtDatabase(DisplayOfScreen(screen))
 
88
#  define XrmPermStringToQuark(str) XrmStringToQuark(str)
 
89
#  define XPointer caddr_t
 
90
#endif
 
91
 
 
92
/*
 
93
 * The MIT X11R5 implementation defines some useful C++
 
94
 * portability stuff.  We redefine it here in case we're using
 
95
 * X11R4 or some other implementation
 
96
 */
 
97
#ifndef _XFUNCPROTOBEGIN
 
98
#  ifdef __cplusplus            /* for C++ V2.0 */
 
99
#    define _XFUNCPROTOBEGIN extern "C" {
 
100
#    define _XFUNCPROTOEND }
 
101
#  else
 
102
#    define _XFUNCPROTOBEGIN
 
103
#    define _XFUNCPROTOEND
 
104
#  endif /* __cplusplus */
 
105
#endif /* _XFUNCPROTOBEGIN */
 
106
 
 
107
/*
 
108
 * const String s; is the same as char * const s; not const char *s;
 
109
 * The latter is really what we want.  As a workaround, we define
 
110
 * a new type StringConst which is a const char *.
 
111
 * Note that we can declare: const StringConst s;
 
112
 */
 
113
#if __STDC__ || defined(__cplusplus) || defined(c_plusplus)
 
114
typedef const char *StringConst;
 
115
#ifndef _Xconst
 
116
#define _Xconst const
 
117
#endif
 
118
#else
 
119
typedef char * StringConst;
 
120
#ifndef _Xconst
 
121
#define _Xconst /* as nothing */
 
122
#endif
 
123
#endif
 
124
 
 
125
/*
 
126
 * In R4 we get the database of a widget with XtDatabase(); in
 
127
 * R5 we use XtScreenDatabase().  So we define a macro that will
 
128
 * do the right thing for us.
 
129
 */
 
130
#ifndef X11R5
 
131
#define XmtDatabaseOfWidget(w) (XtDatabase(XtDisplayOfObject(w)))
 
132
#else
 
133
#define XmtDatabaseOfWidget(w) (XtScreenDatabase(XtScreenOfObject(w)))
 
134
#endif
 
135
 
 
136
/*
 
137
 * Standard C and K&R C handle varargs routines slightly differently.
 
138
 */
 
139
#if NeedVarargsPrototypes
 
140
# include <stdarg.h>
 
141
# define Va_start(a,b) va_start(a,b)
 
142
#else
 
143
# include <varargs.h>
 
144
# define Va_start(a,b) va_start(a)
 
145
#endif
 
146
 
 
147
/*
 
148
 * In K&R C, function arguments are all made at least as long as an int.
 
149
 * In ANSI-C, using prototypes, it is possible to pass function arguments
 
150
 * in their "narrow" form.  This library might be compiled with an ANSI
 
151
 * compiler, but linked with code compiled with K&R, so we have to be
 
152
 * careful not to use narrow arguments in this way, unless we are
 
153
 * explicitly told not to worry about it.
 
154
 *
 
155
 * Client code generally doesn't need to worry about being compiled with
 
156
 * mixed compilers, so you shouldn't have to use these.  If you do, only
 
157
 * use them in the prototypes for function definitions and declarations,
 
158
 * not as variables or structure fields.
 
159
 */
 
160
#if NeedWidePrototypes /* almost always defined to True */
 
161
#define XmtWideBoolean int
 
162
#define XmtWideDimension unsigned int
 
163
#define XmtWidePosition int
 
164
#else
 
165
#define XmtWideBoolean Boolean
 
166
#define XmtWideDimension Dimension
 
167
#define XmtWidePosition Position
 
168
#endif
 
169
 
 
170
/*
 
171
 * if compiling with gcc version 2, there are some cool type-checking and
 
172
 * optimizations things we can do, through gcc extensions to the C grammar.
 
173
 * use -Wformat (or -Wall) to get warnings about bad printf style args.
 
174
 */
 
175
#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(__STRICT_ANSI__)
 
176
/*
 
177
 * these first two are superseded in gcc 2.5, and are no longer
 
178
 * used anywhere in Xmt.  They remain here in case someone else
 
179
 * started using them, though.
 
180
 */
 
181
#define gcc_const_func const
 
182
#define gcc_volatile_func volatile
 
183
#define gcc_printf_func(format_arg_num, first_vararg_num)\
 
184
   __attribute__((format (printf, format_arg_num, first_vararg_num)))
 
185
#if defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 5 && !defined(__STRICT_ANSI__)
 
186
/*
 
187
 * In gcc 2.5 and later, we can define these to help the compiler optimize.
 
188
 * They are actually used in Xmt, so compiling with gcc 2.5 gives a minor
 
189
 * optimization boost.
 
190
 */
 
191
#define gcc_const_attribute __attribute__((const))
 
192
#define gcc_volatile_attribute __attribute__((noreturn))
 
193
#else
 
194
/* if not gcc 2.5 or later, these two aren't defined */
 
195
#define gcc_const_attribute
 
196
#define gcc_volatile_attribute
 
197
#endif
 
198
#else
 
199
/* if not gcc 2.0 or later , none of these are defined */
 
200
#define gcc_const_func
 
201
#define gcc_volatile_func
 
202
#define gcc_printf_func(a,b)
 
203
#define gcc_const_attribute
 
204
#define gcc_volatile_attribute
 
205
#endif
 
206
 
 
207
/*
 
208
 * In X11R5, Intrinsic.h includes Xosdefs.h which defines the symbols
 
209
 * X_NOT_STDC_ENV and X_NOT_POSIX_ENV for systems without the standard
 
210
 * C and Posix header files.  These are useful to know when we can
 
211
 * to include <stdlib.h>, for example, and when we should just declare
 
212
 * the functions we want explicitly.
 
213
 *
 
214
 * X_NOT_STDC_ENV means does not have ANSI C header files.  Lack of this
 
215
 * symbol does NOT mean that the system has stdarg.h.
 
216
 *
 
217
 * X_NOT_POSIX means does not have POSIX header files.  Lack of this
 
218
 * symbol does NOT mean that the POSIX environment is the default.
 
219
 * You may still have to define _POSIX_SOURCE to get it.
 
220
 *
 
221
 * For X11R4, we just include the contents of the X11R5 file here
 
222
 * See the file COPYRIGHT for the applicable MIT copyright notice.
 
223
 */
 
224
#ifndef X11R5
 
225
#ifndef _XOSDEFS_H_
 
226
#define _XOSDEFS_H_
 
227
 
 
228
#ifdef NOSTDHDRS
 
229
#define X_NOT_POSIX
 
230
#define X_NOT_STDC_ENV
 
231
#endif
 
232
 
 
233
#ifdef sony
 
234
#ifndef SYSTYPE_SYSV
 
235
#define X_NOT_POSIX
 
236
#endif
 
237
#endif
 
238
 
 
239
#ifdef UTEK
 
240
#define X_NOT_POSIX
 
241
#define X_NOT_STDC_ENV
 
242
#endif
 
243
 
 
244
#ifdef CRAY
 
245
#define X_NOT_POSIX
 
246
#endif
 
247
 
 
248
#ifdef vax
 
249
#ifndef ultrix                  /* assume vanilla BSD */
 
250
#define X_NOT_POSIX
 
251
#define X_NOT_STDC_ENV
 
252
#endif
 
253
#endif
 
254
 
 
255
#ifdef luna
 
256
#define X_NOT_POSIX
 
257
#define X_NOT_STDC_ENV
 
258
#endif
 
259
 
 
260
#ifdef Mips
 
261
#define X_NOT_POSIX
 
262
#define X_NOT_STDC_ENV
 
263
#endif
 
264
  
 
265
#ifdef USL
 
266
#ifdef SYSV /* (release 3.2) */
 
267
#define X_NOT_POSIX
 
268
#define X_NOT_STDC_ENV
 
269
#endif
 
270
#endif
 
271
 
 
272
#ifdef SYSV386
 
273
#ifdef SYSV
 
274
#define X_NOT_POSIX
 
275
#define X_NOT_STDC_ENV
 
276
#endif
 
277
#endif
 
278
 
 
279
#ifdef MOTOROLA
 
280
#ifdef SYSV
 
281
#define X_NOT_STDC_ENV
 
282
#endif
 
283
#endif
 
284
#endif /* _XOSDEFS_H_ */
 
285
#endif
 
286
 
 
287
/*
 
288
 * In Unix, app-defaults files have the suffix ".ad".  In VMS
 
289
 * they have the suffix ".dat".  We define a symbolic constant
 
290
 * to take care of this difference and use it in ContextHelp.c
 
291
 * and Include.c
 
292
 */
 
293
#ifndef APPDEFAULTSSUFFIX
 
294
#ifndef VMS
 
295
#define APPDEFAULTSSUFFIX ".ad"
 
296
#else
 
297
#define APPDEFAULTSSUFFIX ".dat"
 
298
#endif
 
299
#endif
 
300
 
 
301
/*
 
302
 * some special representation types used in the library
 
303
 */
 
304
 
 
305
/* A special type used in a number of places; different from XtRString */
 
306
#ifndef XmtRBuffer
 
307
#define XmtRBuffer "Buffer"
 
308
#endif
 
309
 
 
310
/* Xt doesn't define an XtRDouble */
 
311
#ifndef XmtRDouble
 
312
#define XmtRDouble "Double"
 
313
#endif
 
314
 
 
315
/*
 
316
 * This macro is an analog to XtOffsetOf.  Instead of returning the
 
317
 * offset of a field in a structure of the specified type, however,
 
318
 * it returns the size of that field.  It is particularly useful when
 
319
 * declaring resource lists with XmtRBuffer resources, because we can't
 
320
 * just use sizeof() with fields like "char name[40];"
 
321
 */
 
322
#define XmtSizeOf(type, field) sizeof(((type *)0)->field)
 
323
 
 
324
/*
 
325
 * DECWindows can't handle XtRemoveCallback, so we make these patches:
 
326
 */
 
327
#if DECWINDOWS_CALLBACK_HACK
 
328
#define XtAddCallback _XmtDECAddCallback
 
329
#define XtRemoveCallback _XmtDECRemoveCallback
 
330
#if NeedFunctionPrototypes
 
331
extern void _XmtDECAddCallback(Widget, String, XtCallbackProc, XtPointer);
 
332
extern void _XmtDECRemoveCallback(Widget, String, XtCallbackProc, XtPointer);
 
333
#else
 
334
extern void _XmtDECAddCallback();
 
335
extern void _XmtDECRemoveCallback();
 
336
#endif
 
337
#endif
 
338
 
 
339
/*
 
340
 * Here is some portability stuff for Motif 1.1
 
341
 */
 
342
#if XmVersion == 1001
 
343
#define XmGetPixmapByDepth(s,i,f,b,d) XmGetPixmap(s,i,f,b)
 
344
#endif
 
345
 
 
346
/*
 
347
 * Some systems (e.g. SunOS 4.1.3_U1) still don't have memmove()
 
348
 */
 
349
#ifdef NO_MEMMOVE
 
350
#undef memmove
 
351
#define memmove(a,b,n) bcopy(b,a,n)
 
352
#endif
 
353
 
 
354
/*
 
355
 * Some common Xmt functions
 
356
 */
 
357
#include <Xmt/Util.h>
 
358
 
 
359
#endif /* _Xmt_h */