ITK Function Reference
(V10000.1.0.60_20160308.00)
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
unidefs.h
Go to the documentation of this file.
1
/*HEAD UNIDEFS HHH INCLUDE */
2
3
#ifndef UNIDEFS_H_INCLUDED
4
#define UNIDEFS_H_INCLUDED
5
6
/*
7
* Common definitions for Unigraphics programming.
8
*
9
* NOTE: This file is for use with ANSI compliant (or nearly so in the VMS
10
* case) compilers. Keywords like "const" are always available and
11
* function prototyping is now expected to work.
12
*
13
* See the "C Programming Standards" for details about the types and symbols
14
* defined here.
15
*
16
* REVISIONS -
17
* RV DATE WHO PR REASON FOR CHANGE
18
* 01 16MAR88 RDB ADD NULENT, PI, TWOPI, RADEG, DEGRA
19
* 02 14SEP88 RDB Add EXIT_SUCCESS, EXIT_FAILURE and Upper case
20
* names for UG types
21
* 03 06JUN89 RDB Correct definitions of FLOGICAL and FTRUE
22
* 04 30MAY90 kdh define FTCOMMON
23
* 05 11JUN90 RDB Add typedef for PVOID, define DEC and PROTO
24
* 06 28JUN90 RDB Combine all versions into one, using sysident.h,
25
* and define BIG_ENDIAN or LITTLE_ENDIAN
26
* 07 06JUL90 RDB Remove lower case typedefs, disable prototypes on HP
27
* 08 16JUL90 JLM Restore lower case typedefs for one phase (II)
28
* 09 05SEP90 KEJ Remove EXIT_... definitions, add "const" {by corvese}
29
* 10 09OCT90 KEJ Correctly ifdef'ed FENTRY, added FCALL {by corvese}
30
* 11 01NOV90 KEJ Added SET_FPTR() and USE_FPTR() to be used when
31
* passing a func to a FTN callable routine {by corvese}
32
* 12 13NOV90 KEJ Redid *_FPTR for dumb AOSVS C compiler {by corvese}
33
* 13 04DEC90 KEJ Support S700 (S300 front end compiler) {by corvese}
34
* 14 30MAY91 TRS DG Macro corrections (by smith)
35
* 15 06JUN91 CVK Add typedef for FSINGLE
36
* 16 16SEP91 JLM Add FTN macro for Fortran callability
37
* 16 16SEP91 JLM Add conditional inclusion for UNIDEFS
38
* 16 23OCT91 JLM Convert to 32 bit integers
39
* 17 28FEB92 JLM Make basic types 'int' instead of 'long'
40
* 17 28FEB92 JLM Add FSHORTINT type
41
* 18 06MAR92 JLM Make FENTITY unsigned
42
* 19 03APR92 JLM FTRUE s/b 1 instead of ~0 on HP Risc
43
* 20 06APR92 JLM Change FLONGINT to 'int' from 'long'
44
* 21 04JUN92 RDB Map the PROTO macro into a real prototype whenever
45
* __STDC__ is 1; remove AOSVS stuff
46
* 22 13Jul92 jeh Add typedef for caddr_t
47
* 23 13Jul92 sch check if type caddr_t defined or not before
48
* doing typedef for it
49
* 24 06Apr93 cdc Used ANSI constructs to clean up definitions, fixed
50
* SET_FPTR and USE_FPTR for ANSI, removed "extern" in
51
* FT_COMMON(), created generic token pasting macro,
52
* removed const define, always set PROTO() to work,
53
* remove SYS card, and added IBM RS6000 dependencies.
54
* 25 02May93 dn Include stddef.h and do not define NULL here
55
* 26 15May93 Reger Removed BIG_ENDIAN/LITTLE_ENDIAN defines (use
56
* DMAN/MACH code instead)
57
* 27 26jun93 kdh make it work on vms remove backslash
58
* 28 03Jul93 Reger OSF needs underscores from FTN macro
59
* 21Jul93 BJS Add logical, byte and tag typedefs
60
* 29 23Sep93 KDH For V10.2 remove sysident.h, use compile line switches
61
* 29 29Sep93 KDH Use intrinsic symbols where possible for machine type
62
* 30 11oct93 kdh change sgi to __sgi - sgi is only defined in K&R land
63
* 31 13oct93 kdh Workaround VAXC problem with FTRUE and FFALSE
64
* 32 19Jul94 kdh define TRUE and FALSE as 1 and 0
65
* 33 25Jul94 jlm remove _SOLARIS_SOURCE and _IRIX_SOURCE
66
* 33 condition token pasting on __STDC__ not VMS
67
* 33 do not mask redefinition of MACHINE_KNOWN
68
* 33 if qaz/lint define FLOGICAL as on VAX
69
* 33 remove hp +ppu compilation support
70
* 24Jun94 MRA Add date_t, true, false, constant, generic_routine_t
71
* conditional definitions (ready for obsoletion of basic.h)
72
* Also pick up definitions for SunOS (still used by IMan)
73
* 29Jun94 MRA Move null_date into clock.h to prevent shared library problems
74
* 04Jul94 MRA Don't define constant macro
75
* 08Aug94 DRD ip1 integration
76
* 09Aug94 DRD Macro paste done by comment hack on SunOS
77
* 16Aug94 BJS Add MAX and MIN macros
78
* Force this to be "needed" for cc_check's dependency analysis
79
* 26Aug94 MRA Remove UNI_PASTE per Jack Marr
80
* 34 05Aug94 dn Remove extern modifier from FTCOMMON, thereby
81
* restoring the FORTRAN COMMON storage model for
82
* FCOMMON's within C object files: this is needed
83
* by loadable modules
84
* 30Aug94 DRD define SUN to __sun on Solaris
85
* 35 23Sep94 JLM Windows NT (WNT) port
86
* 36 02May95 Wei Liu Redefine FTN()
87
* 37 31May95 Wei Liu Replace the definition of FTCOMMON for Bernie Solomon
88
* 38 31May95 Wei Liu Give a number -- 1 to WNT
89
* 39 20Jun95 JLM Add N_ELEMENTS macro
90
* 40 30Jun95 JLM Windows NT Intel port
91
* 41 16Aug95 kdh change msgtxt definition so that cc_check won't
92
* complain, also drop logical cast from true and false
93
* 42 10Aug95 JLM WNTI: convert to append '_' in FTN
94
* 43 17Jan96 kdh Add CHECKING stuff
95
* 44 16Aug96 BJS Revise FLOGICAL types for qaz purposes
96
* 45 10Apr97 Reger Add F2C friendly definitions for tags
97
* 46 24Sep97 JLM Move FTCOMMON to ugextern.h, include that here
98
* 47 24Feb98 Reger Obsolete FSINGLE as a data type
99
* 48 30May98 Reger Remove checks for HP/CISC, SunOS, and VMS (all
100
* obsolete); remove 'FCALL'/'fcall', 'FENTRY/fentry',
101
* 'USE_FPTR', 'SET_FPTR', 'FSHORTINT',
102
* 'FULONGINT/fulongint', 'FUINTEGER/fuinteger',
103
* 'flogical'
104
* 49 16Jun98 Reger Remove 'flongint'/'fentity'/'freal'
105
* 50 31Jul98 Reger Remove 'finteger'
106
* 51 26Aug98 Reger Remove 'FLONGINT'
107
* 52 12Jan99 Reger Remove 'FENTITY'
108
* 53 14Jan99 JLM Remove 'PROTO'
109
* 54 21Jan99 JLM Add qaz/cc_check definition of logical
110
* 55 17Feb99 Reger Add 'UGEXPORT' for Windows/NT
111
* 56 22Mar99 Reger Remove 'FINTEGER'/'FREAL'
112
* 57 16Aug99 Reger Relocate to generic INCLUDE product
113
* 58 15Oct99 Reger Remove 'ugextern.h' and 'checking.h'
114
* 59 07Jun00 Jaskot Added code for IA64 port
115
* 60 25Oct2000 Reger Obsolete WNTA; abandon WNTI -- use WNT instead;
116
* abandon UGEXPORT in favor of DLL specific decorators
117
* 61 25Oct00 JLM Warn about nested inclusion
118
* 62 05Jun01 HRT Define HP64 for 64 bit
119
* 63 24Jul2001 Reger Retire OSF
120
* 64 10Sep01 JLM Add tag_pc_t
121
08-Apr-2003 Steve Kunkee ARCH0015a: C++ compatibility
122
add code to set up C_LINKAGE and C_LINKAGE_CPP
123
16-Apr-2003 Steve Kunkee change CPLUSPLUS_COMPILE to __cplusplus
124
03-Jun-2003 KHafen Remove F2C_FILE
125
10-Jun-2003 Jack Marr Test for wnt platform via _WIN32/_WIN64
126
24-Jul-2003 Jack Marr Add HP IPF platform as HPI
127
24-Mar-2004 Keith Jaskot Ported to x64 platform
128
03-Sep-2004 Jack Marr Define FORCEINLINE
129
10-Sep-2004 jdh logical to bool project
130
20-Sep-2004 jdh more logical to bool project
131
21-Sep-2004 jdh fix comments for FTN macro
132
02-Nov-2004 Keith Jaskot Ported to SUSE Linux
133
*$HISTORY$
134
*/
135
136
/* <BJS> 15-Aug-94
137
Force cc_check's dependency analysis to always assume
138
unidefs.h is needed so it never warns to remove it.
139
<JLM> 13-Sep-00
140
The UG C Standards (Appendix C) require that unidefs.h be included by
141
source files. The top_level_only pragma will cause an error if the
142
first time this file is included is via nested header. Fix this by
143
including unidefs.h first in your source file (or after extended_source.h
144
in those few files where that is required). Eventually we'll
145
want to move the top_level_only pragma outside of the #ifndef
146
UNIDEFS_H_INCLUDED clause so as to warn about every nested inclusion,
147
not just when a source file doesn't directly include it.
148
*/
149
#ifdef __lint
150
#pragma uginclude needed
151
#pragma uginclude top_level_only
152
#pragma uginclude after_only "extended_source.h";
153
#endif
154
155
#include <stddef.h>
156
157
/* use the command line definition of symbols to define the platform we're on */
158
#if defined(__hpux)
159
/* We are on an HPUX system, define UNX and either HPP (PA-RISC) or HPI (Itanium) */
160
#define UNX 1
161
#define HPUX 1
162
#define MACHINE_KNOWN 1
163
164
/* <JLM> 18-Jun-02 Distinguish PA-RISC and IPF (Itanium Processor Family) */
165
#if defined(__hppa)
166
#define HPP 1
167
#elif defined(__ia64)
168
#define HPI 1
169
#else
170
#error Unknown flavor of HP-UX
171
#endif
172
173
/* <HRT> 05-Jun-01
174
This is for 64 bit HP Unix for all HP supported architectures. This should only be defined
175
when +DA2.0W compile flag is used.
176
<JLM> 17-Aug-01
177
Move this bit inside of HPP test. Also define HPP32.
178
<JLM> 18-Jun-02
179
HPP64 should be defined when +DA2.0W or +DD64 compile flags are used.
180
*/
181
#ifdef __LP64__
182
#define HPP64
183
#else
184
#define HPP32
185
#endif
186
187
#endif
188
189
#ifdef __sgi
190
/* We are on an SGI system, define UNX and SGI */
191
#ifndef SGI
192
#define SGI 6
193
#endif
194
#ifndef UNX
195
#define UNX 1
196
#endif
197
#define MACHINE_KNOWN 1
198
#endif
199
200
#ifdef __sun
201
/* We are on a Solaris system, define UNX, SUN and SOLARIS */
202
#ifndef SUN
203
#define SUN __sun
204
#endif
205
#ifndef SOLARIS
206
#define SOLARIS 1
207
#endif
208
#ifndef UNX
209
#define UNX 1
210
#endif
211
#define MACHINE_KNOWN 1
212
213
/* <JLM> 17-Aug-01 Symbols to reveal data model. */
214
#ifdef _LP64
215
#define SOL64
216
#else
217
#define SOL32
218
#endif
219
220
#endif
221
222
#ifdef _AIX
223
/* We are on an IBM system, define UNX and IBM_AIX */
224
#ifndef IBM_AIX
225
#define IBM_AIX 5
226
#endif
227
#ifndef UNX
228
#define UNX 1
229
#endif
230
#define MACHINE_KNOWN 1
231
#endif
232
233
/*
234
Windows NT definitions
235
236
WNT - All Windows NT platforms (IA32 (Intel Pentium 32 bit),
237
IA64 (Intel Itanium 64 bit)
238
WNTI32 - Windows NT IA32 Pentium 32 bit ONLY
239
WNTI64 - Windows NT IA64 Itanium 64 bit ONLY
240
WNTX64 - Windows NT x64 Opteron or Coyote 64 bit ONLY
241
*/
242
243
/* <JLM> 10-Jun-03
244
* Changed test back to _WIN32 vs _WIN64 in order to support other
245
* compilers, specifically the gcc/g++ compiler used for qxdb generation
246
* and eventually qaz checking. _WIN64 needs to be tested first since
247
* _WIN32 is defined in both the _M_IX86 and _M_IA64 regimes.
248
*/
249
250
#if defined(_WIN64)
251
#if defined(_M_IA64)
252
/* We are on a 64 bit Itanium Intel system, define WNT and WNTI64 */
253
#define WNT 1
254
#define WNTI64 1
255
#define MACHINE_KNOWN 1
256
257
#elif defined(_M_AMD64)
258
/* We are on a 64 bit Opteron system, define WNT and WNTX64 */
259
#define WNT 1
260
#define WNTX64 1
261
#define MACHINE_KNOWN 1
262
#endif
263
264
#elif defined(_WIN32)
265
/* We are on a 32 bit Pentium Intel system, define WNT and WNTI32 */
266
#define WNT 1
267
#define WNTI32 1
268
#define MACHINE_KNOWN 1
269
#endif
270
271
/*
272
SUSE Linux Definitions
273
274
UNX Unix or Linux
275
LNX64 SUSE Linux x86_64 only
276
*/
277
278
#if defined(__linux__) && defined(__x86_64__)
279
#define UNX 1
280
#define LNX64 1
281
#define MACHINE_KNOWN 1
282
#endif
283
284
#ifndef MACHINE_KNOWN
285
#error Sorry, you have to change unidefs.h to make this work on this machine
286
#endif
287
288
/* Using strict POSIX compliance on HP's, the caddr_t typedef is hidden.
289
* However it is defined in the Posix.1 namespace on all of our other platforms
290
* and is used fairly widely, so we opt to explicitly define it here for hp.
291
*/
292
#if defined(HPP) && !defined(_CADDR_T)
293
#define _CADDR_T
294
typedef
char
*caddr_t;
295
#elif defined(WNT)
296
typedef
char
*caddr_t;
297
#endif
298
299
#ifndef TAG_T_DEFINED
300
#define TAG_T_DEFINED
301
302
typedef
unsigned
int
tag_t
, *
tag_p_t
;
303
304
typedef
const
tag_t
*
tag_pc_t
;
305
306
#endif
307
308
/* <JLM> 25-Jul-94
309
* For qaz/lint let's use the VMS definition of FLOGICAL
310
* so as to catch circumvention of the typedef
311
* <BJS> 16-Aug-96
312
* Revise qaz/lint version of FLOGICAL to use special
313
* type known to cc_check
314
*/
315
#if defined(__lint)
316
typedef
__FLOGICAL
FLOGICAL
;
317
#elif defined(WNT)
318
typedef
int
FLOGICAL
;
319
#else
320
typedef
unsigned
int
FLOGICAL
;
321
#endif
322
323
/* Definition of TRUE and FALSE for FORTRAN when used from C */
324
/* <BJS> 16-Aug-96
325
* Revise qaz/lint version of FTRUE/FFALSE to use special
326
* definition known to cc_check
327
*/
328
#if defined(__lint)
329
#define FTRUE __FTRUE
330
#define FFALSE __FFALSE
331
#else
332
#define FTRUE ((FLOGICAL) 1)
333
#define FFALSE ((FLOGICAL) 0)
334
#endif
335
336
typedef
void
*
PVOID
;
337
338
/* <BJS> 21-Jul-93
339
The typedefs for logical, tag_t and byte have been copied
340
here from basic.h and are individually protected against
341
multiple definition. Reduces reliance on basic.h.
342
<JLM> 20-Jan-99
343
Use special definition of logical for cc_check purposes.
344
<JDH> 06-sep-2004
345
Change over to bool type.
346
*/
347
#ifndef LOGICAL_DEFINED
348
#define LOGICAL_DEFINED
349
#ifdef __cplusplus
350
typedef
bool
logical
;
351
#else
352
typedef
unsigned
char
logical
;
353
#endif
/* __cplusplus */
354
#endif
/* LOGICAL_DEFINED */
355
356
#ifndef BYTE_DEFINED
357
#define BYTE_DEFINED
358
typedef
unsigned
char
byte
;
359
#endif
360
361
/* Postpend an '_' on FORTRAN symbols referenced from C (if needed) and QAZ.
362
* <JLM> 27-Oct-03
363
* Remove FTN test so we can detect redefinition, and add symbol to minimize
364
* need to port code that needs to know about the need for an underscore.
365
*
366
* <JDH> no-op the FTN macro because we no longer support FORTRAN.
367
*/
368
#ifndef FTN
369
#define FTN(name) name
370
#endif
371
372
/* <MRA> 24-Jun-94
373
Definitions of true and false copied over from basic.h
374
ready for its obsoletion.
375
<KDH> 06-Sep-95
376
Drop the logical cast for true and false, so they match TRUE and FALSE
377
*/
378
#ifndef __cplusplus
379
#ifndef true
380
#define true 1
381
#endif
382
#ifndef false
383
#define false 0
384
#endif
385
#endif
386
/*
387
<KDH> 07-Jul-94
388
Add definition of TRUE and FALSE
389
*/
390
#ifndef TRUE
391
#define TRUE 1
392
#endif
393
#ifndef FALSE
394
#define FALSE 0
395
#endif
396
397
/* <BJS> 15-Aug-94
398
And definitions of the common MIN/MAX macros.
399
*/
400
#ifndef MIN
401
#define MIN(a,b) (((a)<(b))?(a):(b))
402
#endif
403
#ifndef MAX
404
#define MAX(a,b) (((a)>(b))?(a):(b))
405
#endif
406
407
#define NULENT 0
408
409
#define PI 3.14159265358979324
410
#define TWOPI 6.28318530717958648
411
#define RADEG 57.29577951308235
412
#define DEGRA .01745329251994328
413
414
/* <MRA> 24-Jun-94
415
Definitions of the null tag copied over from basic.h ready
416
for basic.h's obsoletion.
417
*/
418
#ifndef NULL_TAG
419
#define NULL_TAG ((tag_t)0)
420
#endif
421
#ifndef null_tag
422
#define null_tag ((tag_t)0)
423
#endif
424
425
#ifndef DATE_T_DEFINED
426
#define DATE_T_DEFINED
427
/* Structure for holding dates
428
When saved this ought to be in GMT/UTC
429
430
Now values are:
431
year - 1989
432
month - 0..11
433
day - 1..28/29/30/31
434
hour - 0..23
435
minute - 0..59
436
second - 0..59
437
438
<MRA> 24-Jun-94
439
Copied over from basic.h ready for basic.h's obsoletion.
440
441
<MRA> 29-Jun-94
442
null_date now in clock.h instead to prevent shared library
443
confusion.
444
*/
445
446
typedef
struct
date_s
447
{
short
year
;
448
byte
month
;
449
byte
day
;
450
byte
hour
;
451
byte
minute
;
452
byte
second
;
453
}
date_t
, *
date_p_t
;
454
#endif
455
456
/* <ARMB> 7-May-93
457
Casting to void* does not necessarily work for function pointers,
458
but all function pointer types can be cast to each other, so long as they
459
are correctly cast back before using to call.
460
Here is a type for things that take different function pointers to be cast
461
too.
462
463
<MRA> 24-Jun-94
464
Copied over from basic.h ready for basic.h's obsoletion.
465
*/
466
#ifndef GENERIC_ROUTINE_T_DEFINED
467
#define GENERIC_ROUTINE_T_DEFINED
468
typedef
void
* (*generic_routine_t)(void);
469
#endif
470
471
/* <MRA> 12-Feb-93
472
This macro is wrapped around UG strings that need to be converted to
473
users' native languages (NLM). Since some of these strings are present
474
in the OM error reporting code, the definition needs to be in a file
475
available to all UG code and to Infomanager code too.
476
477
<MRA> 24-Jun-94
478
Copied over from basic.h ready for basic.h's obsoletion.
479
<kdh> 16-Aug-95
480
MSGTXT used to be defined as MSGTXT(s) (s) This caused qaz errors, so
481
we have simplified the definition.
482
<JLM> 17-Aug-01
483
Remove redefinition protection, since we really want to know about that.
484
*/
485
486
#define MSGTXT(s) s
487
488
/*
489
* <JLM> 20-Jun-95
490
* Macro N_ELEMENTS which determines the number of elements in an
491
* array of any type. Example usage:
492
* qsort(list, N_ELEMENTS(list), sizeof(list[0]), compare);
493
* for (indx=0; indx<N_ELEMENTS(list); indx++) {
494
*/
495
#define N_ELEMENTS(array) (sizeof(array)/sizeof(array[0]))
496
497
/* <SDK> 24-Feb-2003
498
These macros are used to ensure that under a C++ compile the symbols
499
found in LDR_find_symbol calls are C linkage. C_LINKAGE must always
500
be defined, either "C" or empty.
501
*/
502
#ifdef __cplusplus
503
#define C_LINKAGE "C"
504
#else
505
#define C_LINKAGE
506
#endif
507
508
/* <JLM> 03-Sep-04
509
* Macro FORCEINLINE *mandates* that a function be inlined on platforms that
510
* support such a feature (currently only Windows). This macro should be
511
* used sparingly. In general you should use the "inline" keyword to *ask*
512
* that a function be inlined, rather than mandate it.
513
*
514
* From the MS documentation:
515
* The __forceinline keyword overrides the cost/benefit analysis
516
* and relies on the judgment of the programmer instead. Exercise
517
* caution when using __forceinline. Indiscriminate use of
518
* __forceinline can result in larger code with only marginal
519
* performance gains or, in some cases, even performance losses
520
* (due to increased paging of a larger executable, for example).
521
*/
522
#ifndef FORCEINLINE
523
#if (_MSC_VER >= 1200)
524
#define FORCEINLINE __forceinline
525
#elif defined(__cplusplus)
526
#define FORCEINLINE inline
527
#else
528
#define FORCEINLINE
529
#endif
530
#endif
531
532
#endif
/* UNIDEFS_H_INCLUDED */