-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathidl_export.h
3226 lines (2655 loc) · 116 KB
/
idl_export.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* idl_export.h */
/*
* Copyright (c) 1992-2014, Exelis Visual Information Solutions, Inc. All
* rights reserved. Unauthorized reproduction is prohibited.
*/
/*
* NOTICE OF INTENT. PLEASE READ:
*
* This file is intended to supply the external definitions
* required to write and link code against IDL, either to extend
* IDL (CALL_EXTERNAL, Dynamically loadable modules, LINKIMAGE) or
* to use IDL to extend your own program (Callable IDL). Our goal is
* that including this file in your program will enable your program
* to access the public interfaces described in the IDL documentation,
* especially the External Development Guide.
*
* NOT EVERYTHING IN THIS FILE IS A STABLE PUBLIC INTERFACE.
* For various technical reasons, there are things in this file that
* are considered to be private and subject to immediate
* change without notice. Anything in this file that is not
* explicitly documented elsewhere falls into this category. You should
* not use such interfaces, as they are not publically supported and
* may change or disappear without warning.
*
* Examples of such interfaces are:
* - Types and constants that are not discussed in the documentation.
* - Functions that are not discussed elsewhere.
* - Fields of structures that are not discussed in the documentation
* even though the structure itself *is* documented.
*/
#ifndef export_IDL_DEF
#define export_IDL_DEF
#ifdef __cplusplus
extern "C" {
#endif
/***** Definitions from msg_code *****/
#ifndef msg_code_IDL_DEF
#define msg_code_IDL_DEF
/* Warning: These codes can change between releases. */
#define IDL_M_GENERIC -1
#define IDL_M_NAMED_GENERIC -2
#define IDL_M_SYSERR -4
#define IDL_M_BADARRDIM -176
#endif /* msg_code_IDL_DEF */
/***** Definitions from config_arch *****/
#ifdef sun
#ifdef sparc
#define SUN_SPARC
#ifdef __sparcv9 /* Building as 64-bit application */
#define SUN_64
#endif
#else
#define SUN_INTEL
#ifdef __x86_64 /* Predefined - see man cc */
#define SUN_X86_64
#else
#define SUN_X86
#endif
#endif
#endif /* sun */
#if defined(__alpha) && defined(__osf__)
#define ALPHA_OSF
#endif
#if defined(_WIN32) || defined(MSWIN)
#ifndef MSWIN
#define MSWIN
#endif
#ifdef _WIN64
#define MSWIN_64
#else
#define MSWIN_32
#endif
/*
* Important note: WIN32 is also defined for 64-bit Windows. Use
* IDL_MEMINT_64 or MSWIN_64 to detect 64-bit builds.
*/
#ifndef WIN32
#define WIN32
#endif
#endif
#if defined(__linux__) && !defined(linux)
#define linux
#endif
#ifdef linux
#define LINUX_X86
#ifdef __x86_64__
#define LINUX_X86_64
#else
#define LINUX_X86_32
#endif
#endif
#if defined(sgi) && (_MIPS_SZPTR == 64)
#define IRIX_64
#endif
#if defined(_AIX) && defined(__64BIT__)
#define AIX_64
#endif
/*
* Proper ANSI C doesn't allow pre-defined cpp macros that don't start
* with an underscore. Explicitly define the ones we use.
*/
#if defined(__hpux) && !defined(hpux)
#define hpux
#endif
#if defined(__hp9000s800) && !defined(hp9000s800)
#define hp9000s800
#endif
#if defined(hpux) && defined(__LP64__)
#define HPUX_64
#endif
/* darwin */
#ifdef __APPLE__
#ifndef darwin
#define darwin
#endif
#ifdef __ppc__
#define darwin_ppc
#endif
#if defined(__i386__) || defined(__x86_64__)
#ifdef __LP64__
#define darwin_x86_64
#else
#define darwin_i386
#endif
#endif
#endif
/* A rose by any other name: There are multiple ways to say Unix */
#if !defined(unix) && (defined(__unix__) || defined(__unix) || defined(_AIX) || defined(darwin))
#define unix
#endif
/*
* IDL_SIZEOF_C_LONG: The number of bytes contained in a C long
* integer (i.e. sizeof(long)).
*
* IDL_SIZEOF_C_PTR: The number of bytes contained in a machine pointer
* (i.e. sizeof(char *)).
*
* The C language does not specify a required size for the short, int or
* long types. It requires that sizeof(char) is 1, and it requires
* that the following relationship hold:
*
* sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long).
*
* In the days of 16-bit computing (16-bit machine pointers), it was
* common for short and int to be 2 bytes (16-bits), and sizeof(long)
* to be 4 (32-bit). In the era of 32-bit computing (32-bit machine
* pointers), it was almost always true that short remains at 2 bytes
* while both int and long were 32-bit quantities. This is commonly
* called ILP32, and is the model used on all 32-bit platforms ever
* supported by IDL.
*
* 64-bit systems fall into two camps: Unix systems use the LP64 model,
* in which sizeof(short) is 2, sizeof(int) is 4, and both sizeof(long)
* and machine pointers are 8 (64-bit). Microsoft Windows uses a different
* approach: sizeof(long) remains at 4 while machine pointers move to 8,
* and programmers use an explicitly defined type for 64-bit integers.
*
* Note that although sizeof(long) generally tracks sizeof(machine pointer),
* this relationship cannot be always be relied on, so both sizes must be
* known independently.
*/
#if defined(ALPHA_OSF) || defined(SUN_64) || defined(LINUX_X86_64) || defined(HPUX_64) || defined(IRIX_64) || defined(AIX_64) || defined(darwin_x86_64) || defined(SUN_X86_64)
#define IDL_SIZEOF_C_LONG 8
#else
#define IDL_SIZEOF_C_LONG 4
#endif
#if (IDL_SIZEOF_C_LONG == 8) || defined(MSWIN_64)
#define IDL_SIZEOF_C_PTR 8
#else
#define IDL_SIZEOF_C_PTR 4
#endif
/***** Definitions from config *****/
#ifndef config_IDL_DEF
#define config_IDL_DEF
#include <stdarg.h>
#ifndef IDL_DEBUGGING
#define IDL_DEBUGGING 1
#endif
#ifdef FALSE
#undef FALSE
#endif
#define FALSE (0)
#ifdef TRUE
#undef TRUE
#endif
#define TRUE (1)
/*
* The following definitions are to be used in all modules. They
* are used by cx to generate .x files. cx_public is used for functions that
* are used outside a module, but which are private. cx_export is used
* for functions that outside customers can use.
*/
#define cx_public /* C default file scope, private */
#define cx_export /* C default file scope, visible in idl_export.h */
/*
* Microsoft Windows has two calling conventions, __stdcall and __cdecl. We
* refer to them using the following macros so that they can be easily
* nulled on non-MS platforms.
*/
#ifdef MSWIN
#define IDL_STDCALL __stdcall
#define IDL_CDECL __cdecl
#else
#define IDL_STDCALL
#define IDL_CDECL
#endif
/*
* Some platforms support tty based user interaction (Unix)
* while others (Windows) don't. On those that don't, we
* want to avoid compiling code that will never be called.
* This symbol is defined on those systems that support ttys.
*/
#ifdef unix
#define IDL_OS_HAS_TTYS
#endif
#if IDL_DEBUGGING < 2
#define IDL_REGISTER register /* Use explicit register declarations */
#else
#define IDL_REGISTER
#endif
/**** Maximum # of array dimensions ****/
#define IDL_MAX_ARRAY_DIM 8
/**** Maximum # of params allowed in a call ****/
#define IDL_MAXPARAMS 65535 /* 2^16 - 1 */
/*
* IDL_PTRINT is an integer type of the same size as a machine pointer.
* It can hold a pointer without truncation or excess range.
* IDL_TYP_PTRINT is the IDL typecode for the IDL type that maps to
* an IDL_PTRINT.
*/
#if IDL_SIZEOF_C_PTR == 8 /* 64-bit systems */
#define IDL_TYP_PTRINT IDL_TYP_LONG64
#if IDL_SIZEOF_C_LONG == 8 /* LP64 */
typedef long IDL_PTRINT;
#elif defined(MSWIN)
typedef __int64 IDL_PTRINT;
#else
#error "IDL_PTRINT not defined --- unexpected value of IDL_SIZEOF_C_LONG"
#endif
#elif IDL_SIZEOF_C_PTR == 4 /* 32-bit systems --- all ILP32 */
typedef long IDL_PTRINT;
#define IDL_TYP_PTRINT IDL_TYP_LONG
#else
#error "IDL_PTRINT not defined --- unexpected value of IDL_SIZEOF_C_PTR"
#endif
/*** Maximum length of an identifier ***/
#define IDL_MAXIDLEN 1000
/**** Longest allowed file path specification ****/
#ifdef MSWIN
#define IDL_MAXPATH 1024
#else
#define IDL_MAXPATH 1024 /* That's what BSD allows */
#endif
#endif /* config_IDL_DEF */
/***** Definitions from defs *****/
#ifndef defs_IDL_DEF
#define defs_IDL_DEF
#if !defined(MSWIN) || !defined(PLTYPES)
typedef unsigned char UCHAR; /* Unsigned character type */
#endif
/* Boolean. */
typedef enum {
IDL_FALSE = 0,
IDL_TRUE = 1
} IDLBool_t;
/*
* IDL integer types. For historical reasons, we use UCHAR for TYP_BYTE
* instead of defining an IDL_BYTE type.
*/
typedef short IDL_INT;
typedef unsigned short IDL_UINT;
#if IDL_SIZEOF_C_LONG == 8
typedef int IDL_LONG;
typedef unsigned int IDL_ULONG;
#elif IDL_SIZEOF_C_LONG == 4
typedef long IDL_LONG;
typedef unsigned long IDL_ULONG;
#else
#error "IDL_LONG not defined --- unexpected value of IDL_SIZEOF_C_LONG"
#endif
#ifdef MSWIN
typedef __int64 IDL_LONG64;
typedef unsigned __int64 IDL_ULONG64;
#else
typedef long long IDL_LONG64;
typedef unsigned long long IDL_ULONG64;
#endif
/* Type used for pointer and object reference variables is same as IDL_LONG */
typedef IDL_ULONG IDL_HVID;
/*
* Define IDL_VARIABLE type values - Note that IDL_TYP_UNDEF is always 0 by
* definition. It is correct to use the value 0 in place of IDL_TYP_UNDEF.
* It is not correct to assume the value assigned to any other
* type - the preprocessor definitions below must be used.
*/
#define IDL_TYP_UNDEF 0
#define IDL_TYP_BYTE 1
#define IDL_TYP_INT 2
#define IDL_TYP_LONG 3
#define IDL_TYP_FLOAT 4
#define IDL_TYP_DOUBLE 5
#define IDL_TYP_COMPLEX 6
#define IDL_TYP_STRING 7
#define IDL_TYP_STRUCT 8
#define IDL_TYP_DCOMPLEX 9
#define IDL_TYP_PTR 10
#define IDL_TYP_OBJREF 11
#define IDL_TYP_UINT 12
#define IDL_TYP_ULONG 13
#define IDL_TYP_LONG64 14
#define IDL_TYP_ULONG64 15
#define IDL_MAX_TYPE 15
#define IDL_NUM_TYPES 16
/*
* Various machines use different data types for representing memory
* and file offsets and sizes. We map these to IDL types using the
* following definitions. Doing it this way lets us easily change
* the mapping here without having to touch all the code that uses
* these types.
*/
/*
* Memory is currently limited to 2^31 on most platforms. If using 64-bit
* addressing on systems that can do it, we define IDL_MEMINT_64 for the
* benefit of code that needs to know.
*
* MEMINT must always be a signed type.
*/
#if IDL_SIZEOF_C_PTR == 8
#define IDL_MEMINT_64
#define IDL_TYP_MEMINT IDL_TYP_LONG64
#define IDL_TYP_UMEMINT IDL_TYP_ULONG64
#define IDL_MEMINT IDL_LONG64
#define IDL_UMEMINT IDL_ULONG64
#elif IDL_SIZEOF_C_PTR == 4
#define IDL_TYP_MEMINT IDL_TYP_LONG
#define IDL_TYP_UMEMINT IDL_TYP_ULONG
#define IDL_MEMINT IDL_LONG
#define IDL_UMEMINT IDL_ULONG
#else
#error "IDL_MEMINT not defined --- unexpected value of IDL_SIZEOF_C_PTR "
#endif
#if defined(sun) || defined(ALPHA_OSF) || defined(sgi) || defined(hpux) || defined(MSWIN) || defined(linux) || defined(_AIX) || defined(darwin)
/* Files can have 64-bit sizes */
#define IDL_FILEINT_64
#define IDL_TYP_FILEINT IDL_TYP_LONG64
#define IDL_FILEINT IDL_LONG64
#else /* Stick with 2^31 sized files */
#define IDL_TYP_FILEINT IDL_TYP_LONG
#define IDL_FILEINT IDL_LONG
#endif
/*
* The above type codes each have a bit mask value associated with
* them. The bit mask value is computed as (2**Type_code), but the
* following definitions can also be used. Some routines request the
* bit mask value instead of the type code value.
*
* Simple types are everything except TYP_STRUCT, TYP_PTR, and TYP_OBJREF.
*/
#define IDL_TYP_B_SIMPLE 62207
#define IDL_TYP_B_ALL 65535
/* This macro turns it's argument into its bit mask equivalent.
* The argument type_code should be one of the type codes defined
* above.
*/
#define IDL_TYP_MASK(type_code) (1 << type_code)
/***** IDL_VARIABLE flag values ********/
#define IDL_V_CONST 1 /* A variable that does not have a name,
and which is treated as a static
non-assignable expression by the interpreter.
The most common example is a lexical
constant. Different from V_TEMP in that
V_CONST variables are not part of the
temporary variable pool, and because IDL
can alter the value of a V_TEMP variable
under some circumstances. */
#define IDL_V_TEMP 2 /* An unnamed variable from the IDL temporary
variable pool, used to hold the results
of expressions, and often returned as the
result of IDL system functions */
#define IDL_V_ARR 4 /* Variable has an array block, accessed via
the value.arr field of IDL_VARIABLE, and
the data is kept there. If V_ARR is not
set, the variable is scalar, and the value
is kept directly within the value union. */
#define IDL_V_FILE 8 /* An ASSOC variable. Note that V_ARR is
not set for ASSOC variables, but they
still have array blocks. */
#define IDL_V_DYNAMIC 16 /* Variable contains pointers to other
data that must be cleaned up when the
variable is destroyed. This happens
with scalar strings, or arrays of any
type. */
#define IDL_V_STRUCT 32 /* Variable is a structure. V_ARR is always
set when V_STRUCT is set (there are no
scalar structures) */
#define IDL_V_NULL 64 /* Variable is !NULL */
#define IDL_V_BOOLEAN 128 /* Variable is special Boolean byte type */
#define IDL_V_NOT_SCALAR (IDL_V_ARR | IDL_V_FILE | IDL_V_STRUCT)
/**** IDL_ARRAY flag values ****/
#define IDL_A_FILE 1 /* Array is a FILE variable (ASSOC) */
#define IDL_A_NO_GUARD 2 /* Indicates no data guards for array */
#define IDL_A_FILE_PACKED 4 /* If array is a FILE variable and the data
type is IDL_TYP_STRUCT, then I/O to
this struct should assume packed data
layout compatible with WRITEU instead of
being a direct mapping onto the struct
including its alignment holes. */
#define IDL_A_FILE_OFFSET 8 /* Only set with IDL_A_FILE. Indicates that
variable has a non-zero offset to the base
of the data for the file variable, as
contained in the IDL_ARRAY offset field.
IDL versions prior to IDL 5.5 did not
properly SAVE and RESTORE the offset of
a file variable. Introducing this bit in
IDL 5.5 makes it possible for us to
generate files that older IDLs will be
able to read as long as that file does
not contain any file variables with
non-zero file offsets. If not for this
minor compatability win, this bit would
serve no significant purpose. */
#define IDL_A_SHM 16 /* This array is a shared memory segment */
/**** Basic IDL structures: ****/
typedef struct {
float r,i;
} IDL_COMPLEX;
typedef struct {
double r,i;
} IDL_DCOMPLEX;
/*
* History of IDL_STRING slen field:
*
* Originally, the length field of IDL_STRING was set to short because
* that allowed IDL and VMS string descriptors to be identical and
* interoperable, a feature that IDL exploited to simplify string handling.
* Also, on most 32-bit machines this resulted in sizeof(IDL_STRING) being 8.
* This was very good, because it avoided causing the sizeof(IDL_VARIABLE)
* to be increased by the inclusion of an IDL_STRING in the values field
* (prior to the addition of TYP_DCOMPLEX, the biggest thing in the values
* field was 8 bytes). IDL's speed is partly gated by the size of a variable,
* so this is an important factor. Unfortunately, that results in a
* maximum string length of 64K, long enough for most things, but not
* really long enough.
*
* In IDL 5.4, the first 64-bit version of IDL was released. I realized that
* we could make the length field be a 32-bit int without space penalty
* (the extra room comes from wasted "holes" in the struct due to pointers
* being 8 bytes long). Since there is no issue with VMS (no 64-bit VMS IDL
* was planned), I did so. 32-bit IDL stayed with the 16-bit length field
* for backwards compatability and VMS support.
*
* With IDL 5.5, the decision was made to drop VMS support. This decision
* paves the way for 32-bit IDL to also have a 32-bit length field in
* IDL_STRING. Now, all versions of IDL have the longer string support.
* This does not increase the size of an IDL_VARIABLE, because the biggest
* thing in the value field is 16 bytes (DCOMPLEX), and sizeof(IDL_STRING)
* will be 12 on most systems.
*/
typedef int IDL_STRING_SLEN_T;
#define IDL_STRING_MAX_SLEN 2147483647
typedef struct { /* Define string descriptor */
IDL_STRING_SLEN_T slen; /* Length of string, 0 for null */
short stype; /* type of string, static or dynamic */
char *s; /* Addr of string */
} IDL_STRING;
/**** IDL identifiers ****/
typedef struct _idl_ident {
struct _idl_ident *hash; /* Must be the first field */
char *name; /* Identifier text (NULL terminated */
int len; /* # of characters in id, not counting NULL
termination. */
} IDL_IDENT;
/*
* Type of the free_cb field of IDL_ARRAY. When IDL deletes a variable and
* the free_cb field of ARRAY non-NULL, IDL calls the function that field
* references, passing the value of the data field as it's sole argument.
* The primary use for this notification is to let programs know when
* to clean up after calls to IDL_ImportArray(), which is used to create
* arrays using memory that IDL does not allocate.
*/
typedef void (* IDL_ARRAY_FREE_CB)(UCHAR *data);
/* Type of the dim field of an IDL_ARRAY. */
typedef IDL_MEMINT IDL_ARRAY_DIM[IDL_MAX_ARRAY_DIM];
typedef struct { /* Its important that this block
be an integer number of longwords
in length to ensure that array
data is longword aligned. */
IDL_MEMINT elt_len; /* Length of element in char units */
IDL_MEMINT arr_len; /* Length of entire array (char) */
IDL_MEMINT n_elts; /* total # of elements */
UCHAR *data; /* ^ to beginning of array data */
UCHAR n_dim; /* # of dimensions used by array */
UCHAR flags; /* Array block flags */
short file_unit; /* # of assoc file if file var */
IDL_ARRAY_DIM dim; /* dimensions */
IDL_ARRAY_FREE_CB free_cb; /* Free callback */
IDL_FILEINT offset; /* Offset to base of data for file var */
IDL_MEMINT data_guard; /* Guard longword */
} IDL_ARRAY;
typedef struct { /* Reference to a structure */
IDL_ARRAY *arr; /* ^ to array block containing data */
struct _idl_structure *sdef; /* ^ to structure definition */
} IDL_SREF;
/* IDL_ALLTYPES can be used to represent all IDL_VARIABLE types */
typedef union {
char sc; /* A standard char, where "standard" is defined
by the compiler. This isn't an IDL data
type, but having this field is sometimes
useful for internal code */
UCHAR c; /* Byte value */
IDL_INT i; /* 16-bit integer */
IDL_UINT ui; /* 16-bit unsigned integer */
IDL_LONG l; /* 32-bit integer */
IDL_ULONG ul; /* 32-bit unsigned integer */
IDL_LONG64 l64; /* 64-bit integer */
IDL_ULONG64 ul64; /* 64-bit unsigned integer */
float f; /* 32-bit floating point value */
double d; /* 64-bit floating point value */
IDL_COMPLEX cmp; /* Complex value */
IDL_DCOMPLEX dcmp; /* Double complex value */
IDL_STRING str; /* String descriptor */
IDL_ARRAY *arr; /* ^ to array descriptor */
IDL_SREF s; /* Descriptor of structure */
IDL_HVID hvid; /* Heap variable identifier */
/* The following are mappings to basic types that vary between platforms */
IDL_MEMINT memint; /* Memory size or offset */
IDL_FILEINT fileint; /* File size or offset */
IDL_PTRINT ptrint; /* A pointer size integer */
} IDL_ALLTYPES;
typedef struct { /* IDL_VARIABLE definition */
UCHAR type; /* Type byte */
UCHAR flags; /* Flags byte */
UCHAR flags2;
IDL_ALLTYPES value;
} IDL_VARIABLE;
typedef IDL_VARIABLE *IDL_VPTR;
/* Signatures for IDL system routines */
typedef void (* IDL_SYSRTN_PRO)(int argc, IDL_VPTR argv[], char *argk);
typedef IDL_VPTR (* IDL_SYSRTN_FUN)(int argc, IDL_VPTR argv[], char *argk);
/*
* IDL_SYSRTN_GENERIC is used to refer to system routines of either
* type (function or procedure). It is conceptually equivalent to a
* C (void *). It should never be used for calling the routine, but only
* for initializing structures or simple pointer comparisons.
*/
typedef IDL_VARIABLE *(* IDL_SYSRTN_GENERIC)();
/* IDL_FUN_RET is an obsolete name for IDL_SYSRTN_GENERIC */
#define IDL_FUN_RET IDL_SYSRTN_GENERIC
/*
* Union used to hold system routine pointers within IDL_SYSFUN_DEF2
* structures.
*/
typedef union {
IDL_SYSRTN_GENERIC generic; /* Used for generic access to the routine
pointer. The Ansi C spec (K&R 2nd edition)
says that union initializations always
refer to the first field in the union.
Hence, this must be the first field. */
IDL_SYSRTN_PRO pro; /* System procedure pointer */
IDL_SYSRTN_FUN fun; /* System function pointer */
} IDL_SYSRTN_UNION; /* ^ to interp. function (ret ^ to VAR) */
/*
* This K&R typedef is pure trouble in a full 64-bit environment, and is
* no longer used in IDL. We continue to export it for now until the EDG
* has been purged of it and people have had a chance to modify their
* code. Ultimately, it is destined for obsolete.h.
*/
typedef void (* IDL_PRO_PTR)(); /* ^ to interpreter procedure (ret is void) */
/* Possible values for the flags field of IDL_SYSFUN_DEF and IDL_SYSFUN_DEF2 */
#define IDL_SYSFUN_DEF_F_OBSOLETE 1 /* Routine is obsolete */
#define IDL_SYSFUN_DEF_F_KEYWORDS 2 /* Routine accepts keywords */
#define IDL_SYSFUN_DEF_F_METHOD 32 /* Routine is an object method */
#define IDL_SYSFUN_DEF_F_NOPROFILE 512 /* By default routine is not profiled */
#define IDL_SYSFUN_DEF_F_STATIC 1024 /* Routine is a static method */
/*
* The IDL_SYSFUN_DEF2 structure defines the format of a system procedure
* or function table entry.
*/
typedef struct {
IDL_SYSRTN_UNION funct_addr; /* Address of function, or procedure. */
char *name; /* The name of the function */
unsigned short arg_min; /* Minimum allowed argument count. */
unsigned short arg_max; /* Maximum argument count. */
int flags; /* IDL_SYSFUN_DEF_F_* flags */
void *extra; /* Caller should set this to 0 */
} IDL_SYSFUN_DEF2;
/**** IDL structures ****/
/*
* Type of pointer to an IDL structure definition. Through trickery, we
* make it opaque for use outside of IDL.
*/
typedef struct _idl_structure *IDL_StructDefPtr;
typedef struct _idl_tagdef { /* Definition of each instance of a tag
in a structure: */
IDL_IDENT *id;
IDL_MEMINT offset; /* Offset of this tag within struct */
IDL_VARIABLE var; /* Definition of this tag's field. */
} IDL_TAGDEF;
typedef struct _idl_structure { /* Structure definition: */
IDL_IDENT *id; /* The name of this structure. NULL
for anonymous structure. */
UCHAR flags; /* Structure attribute flags */
UCHAR contains_string; /* TRUE if structure contains strings or
heap variables, and FALSE otherwise. */
int ntags; /* The number of tags in this structure */
IDL_MEMINT length; /* Length in bytes of each instance of
this structure. */
IDL_MEMINT data_length; /* Length in bytes of the data contained in
each instance of this structure. This is
(length - struct alignment-holes) */
int rcount; /* Reference count: only for anon structs */
void *object;
IDL_ARRAY *tag_array_mem; /* If the IDL_ARRAY descriptors for the
tags was not allocated at the end of
the same memory block as the array, this
field contains the pointer to their memory.
This is used to free the memory when the
.reset_session executive command is
executed. Otherwise it is NULL. */
IDL_TAGDEF tags[1]; /* Array of ntags tagdefs. */
} IDL_STRUCTURE;
#endif /* defs_IDL_DEF */
/***** Definitions from message *****/
#ifndef message_IDL_DEF
#define message_IDL_DEF
/*
* action parameter to message is composed of two parts. These two masks
* are used to separate them out.
*/
#define IDL_MSG_ACTION_CODE 0x0000ffff
#define IDL_MSG_ACTION_ATTR 0xffff0000
/* Allowed codes for action parameter to IDL_Message() */
#define IDL_MSG_RET 0 /* Return to caller */
#define IDL_MSG_EXIT 1 /* Terminate process via exit(3) */
#define IDL_MSG_LONGJMP 2 /* General error. Obey the error handling
established by the ON_ERROR user
procedure. */
#define IDL_MSG_IO_LONGJMP 3 /* I/O error. Obey the error handling
established by the ON_IOERROR user
procedure. */
#define IDL_MSG_INFO 4 /* Informational. Like IDL_MSG_RET, but won't
set !ERR or !ERR_STRING. Also,
inhibited by !QUIET */
#define IDL_MSG_SUPPRESS 7 /* IDL_Message() returns immediately
without processing the message at all.
This code can be used to implement
libraries of code that can throw errors
or simply return status depending on
the input value of the action
parameter. */
/* Allowed attribute masks that can be OR'd into the action code */
#define IDL_MSG_ATTR_NOPRINT 0x00010000 /* Suppress the printing of
the error text to stderr,
but do everything else in
the normal way. */
#define IDL_MSG_ATTR_MORE 0x00020000 /* Use IDL_more() instead of printf(3S)
to output the message. The calling
routine must worry about calling
IDL_more_reset(). A side effect of
this is that the message goes to the
file named in IDL_more_reset(), not
necessarily stderr. */
#define IDL_MSG_ATTR_NOPREFIX 0x00040000 /* Don't output the normal
message (from
!ERROR_STATE.MSG_PREFIX),
just the message text. */
#define IDL_MSG_ATTR_QUIET 0x00080000 /* If the message would normally
be printed and !QUIET is
non-zero, the printing
is suppressed. Everything
else is updated as expected. */
#define IDL_MSG_ATTR_NOTRACE 0x00100000 /* Suppress traceback message */
#define IDL_MSG_ATTR_BELL 0x00200000 /* Ring the bell */
#define IDL_MSG_ATTR_SYS 0x00400000 /* IDL_Message() only: Include
system supplied error message,
via errno. Note that other types
of syscodes cannot be handled
via this mechanism, and that
it is considered to be
obsolete. Use
IDL_MessageSyscode() instead. */
/*
* Types of system error code that can be passed to IDL_MessageSyscode()
* and IDL_MessageSyscodeFromBlock().
*
* NOTE:
* - The message module depends on the specific values of
* these constants. They cannot be arbitrarily reassigned.
* - The constants are only defined on platforms where that
* error type is possible. This is to help catch uses of
* them on incorrect platforms.
*/
typedef enum {
IDL_MSG_SYSCODE_NONE=0, /* There is no system error part */
IDL_MSG_SYSCODE_ERRNO=1 /* Unix style errno based error */
#ifdef MSWIN
, IDL_MSG_SYSCODE_WIN=2 /* Windows system codes (aka GetLastError() */
, IDL_MSG_SYSCODE_WINSOCK=3 /* MS Windows winsock error codes
WSAGetLastError()*/
#endif
} IDL_MSG_SYSCODE_T;
/* The type of elements in the defs argument to IDL_MessageDefineBlock() */
typedef struct {
char *name;
char *format;
} IDL_MSG_DEF;
/* Type returned by IDL_MessageDefineBlock() */
typedef void *IDL_MSG_BLOCK;
#define IDL_MSG_ERR_BUF_LEN 2048 /* Intentionally huge */
#define IDL_MSG_SYSERR_BUF_LEN 512 /* Need not be so big */
typedef struct {
int action; /* As passed to IDL_Message(). */
IDL_MSG_BLOCK msg_block; /* Message block containing error */
int code; /* Message code within msg_block */
int global_code; /* Message code mapped into global
IDL message space */
IDL_MSG_SYSCODE_T syscode_type; /* System error code type */
int syscode; /* System error code */
char msg[IDL_MSG_ERR_BUF_LEN]; /* Text of IDL part of message */
char sysmsg[IDL_MSG_SYSERR_BUF_LEN]; /* Text of system part of message */
} IDL_MSG_ERRSTATE;
/*
* Opaque type. Not for non-IDL-internal use. Set any arguments of
* this type to NULL.
*/
typedef void *IDL_MSG_ERRSTATE_PTR;
#endif /* message_IDL_DEF */
/***** Definitions from macros *****/
#ifndef macros_IDL_DEF
#define macros_IDL_DEF
#define IDL_VENDOR_NAME "Exelis Visual Information Solutions, Inc."
#define IDL_VENDOR_CONTACT "[email protected]"
#define IDL_PRODUCT_NAME "IDL"
#define IDL_PRODUCT_NAME_LC "idl"
#define IDL_VENDOR_NAME_CONTACT IDL_VENDOR_NAME " at " IDL_VENDOR_CONTACT
/* General math macros */
#define IDL_MIN(x,y) (((x) < (y)) ? (x) : (y))
#define IDL_MAX(x,y) (((x) > (y)) ? (x) : (y))
#define IDL_ABS(x) (((x) >= 0) ? (x) : -(x))
#define IDL_C_ABS(pZ) ((pZ)->r*(pZ)->r + (pZ)->i*(pZ)->i)
/* Return x in the range of min <= x <= max */
#define IDL_CLIP_TO_RANGE(x, min, max) \
((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
/* Round x up modulo m. m must be a power of 2 : */
#define IDL_ROUND_UP(x,m) \
(((x) + (m-1)) & (~(m-1)))
/**** Cast a pointer to (char *) ****/
#define IDL_CHAR(x) ((char *) x)
/**** Take the address of a variable and cast to a desired type ****/
#define IDL_CHARA(x) ((char *) &(x))
#define IDL_UCHARA(x) ((UCHAR *) &(x))
#define IDL_SHORTA(x) ((short *) &(x))
#define IDL_INTA(x) ((int *) &(x))
#define IDL_LONGA(x) ((IDL_LONG *) &(x))
/**** Get pointer to a valid string from an IDL_STRING descriptor */
#define IDL_STRING_STR(desc) ((desc)->slen ? (desc)->s : "")
/**** Compute strlen() of a static lexical C string at compile time ****/
#define IDL_STATIC_STRLEN(lexstr) (sizeof(lexstr) - 1)
/**** Initialize an IDL_STRING descriptor from a static lexical C string ****/
#define IDL_STATIC_STRING(lexstr) { IDL_STATIC_STRLEN(lexstr), 0, lexstr }
#define IDL_DELTMP(v) { if (((v)->flags) & IDL_V_TEMP) IDL_Deltmp(v); }
/**** How many elements are there in a C 1D array? ****/
#define IDL_CARRAY_ELTS(arr) (sizeof(arr)/sizeof(arr[0]))
#define IDL_EXCLUDE_UNDEF(v) { if (!(v)->type) \
IDL_MessageVE_UNDEFVAR(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_CONST(v) { if ((v)->flags & IDL_V_CONST) \
IDL_MessageVE_NOCONST(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_EXPR(v) { if ((v)->flags & (IDL_V_CONST | IDL_V_TEMP)) \
IDL_MessageVE_NOEXPR(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_FILE(v) { if ((v)->flags & IDL_V_FILE) \
IDL_MessageVE_NOFILE(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_STRUCT(v) { if ((v)->flags & IDL_V_STRUCT) \
IDL_MessageVE_NOSTRUCT(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_FILE_OR_STRUCT(v) { \
if((v)->flags & (IDL_V_FILE|IDL_V_STRUCT)) \
IDL_VarExclude(v, IDL_TYP_MASK(TYP_STRUCT), FALSE, FALSE, TRUE);}
#define IDL_EXCLUDE_COMPLEX(v) { if (((v)->type == IDL_TYP_COMPLEX) \
|| ((v)->type == IDL_TYP_DCOMPLEX)) \
IDL_MessageVE_NOCOMPLEX(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_STRING(v) { if ((v)->type == IDL_TYP_STRING) \
IDL_MessageVE_NOSTRING(v, IDL_MSG_LONGJMP); }
#define IDL_EXCLUDE_SCALAR(v) { if (!((v)->flags & IDL_V_NOT_SCALAR)) \
IDL_MessageVE_NOSCALAR(v, IDL_MSG_LONGJMP);}
/*
* Disallow variables with 64-bit addressing requirements. A routine does this
* if its code contains 32-bit limitations.
*/
#ifdef IDL_MEMINT_64
#define IDL_EXCLUDE_BIGVAR(v) \
if ((v->flags & IDL_V_ARR) && IDL_MEMINT_BIG(v->value.arr->n_elts)) \
IDL_MessageVE_NOMEMINT64(v, IDL_MSG_LONGJMP);
#define IDL_BIGVAR(v) \
((v->flags & IDL_V_ARR) && IDL_MEMINT_BIG(v->value.arr->n_elts))
#else
#define IDL_EXCLUDE_BIGVAR(v)
#define IDL_BIGVAR(v) IDL_FALSE
#endif
/*
* Ensure that variables possess certain attributes.
*
* NOTE: It is usually better not to ENSURE_SCALAR in situations
* where a 1-element array will also work. For strings,
* IDL_VarGetString() is recommended. For other data types,
* the IDL_*Scalar() family of functions handle this case.
*/
#define IDL_ENSURE_ARRAY(v) { if (!((v)->flags & IDL_V_ARR)) \
IDL_MessageVE_NOTARRAY(v, IDL_MSG_LONGJMP); }
#define IDL_ENSURE_SCALAR(v) { if ((v)->flags & IDL_V_NOT_SCALAR) \
IDL_MessageVE_NOTSCALAR(v, IDL_MSG_LONGJMP);}
#define IDL_ENSURE_STRING(v) { if ((v)->type != IDL_TYP_STRING) \
IDL_MessageVE_REQSTR(v, IDL_MSG_LONGJMP);}
#ifndef IDL_ENSURE_SIMPLE
#define IDL_ENSURE_SIMPLE(v) IDL_VarEnsureSimple(v)
#endif
#define IDL_ENSURE_STRUCTURE(v) { if (!((v)->flags & IDL_V_STRUCT)) \
IDL_MessageVE_STRUC_REQ(v, IDL_MSG_LONGJMP);}
#define IDL_ENSURE_PTR(v) { if ((v)->type != IDL_TYP_PTR) \
IDL_MessageVE_REQPTR(v, IDL_MSG_LONGJMP);}
#define IDL_ENSURE_OBJREF(v) { if ((v)->type != IDL_TYP_OBJREF) \
IDL_MessageVE_REQOBJREF(v, IDL_MSG_LONGJMP);}
/* Check if var has a dynamic part. If so, delete it using IDL_Delvar */
#define IDL_DELVAR(v) { if (((v)->flags) & IDL_V_DYNAMIC) IDL_Delvar(v); }
// BOOLEAN: Check if var is a BOOLEAN
#define IDL_BOOLEAN(v) \
((v)->type == IDL_TYP_BYTE && (v)->flags & IDL_V_BOOLEAN)
/* !NULL: Check if var is the null variable. */
#define IDL_NULL(v) \
((v)->flags & IDL_V_NULL)
#if defined(HPUX_64) || (defined(__cplusplus) && defined(MSWIN)) || defined(darwin) || defined(linux) || defined(MSWIN_64)
#define IDL_CAST_PTRINT(cast, orig_value) ((cast) ((IDL_PTRINT) (orig_value)))
#else
#define IDL_CAST_PTRINT(cast, orig_value) ((cast) (orig_value))
#endif