/
gambit.h.in
8822 lines (7787 loc) · 277 KB
/
gambit.h.in
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
/* File: "gambit.h", Time-stamp: <2007-12-14 08:27:40 feeley> */
/*
* Copyright (c) 1994-2007 by Marc Feeley, All Rights Reserved.
*/
#ifndef ___GAMBIT_H
#define ___GAMBIT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef ___VERSION
@error "___VERSION has not been set by includer"
#endif
#if ___VERSION != 401001
#include "gambit-not401001.h"
#else
/*---------------------------------------------------------------------------*/
/*
* This section determines the following characteristics of the target
* platform:
*
* - target operating system (WIN32, POSIX, etc)
* - target processor type (x86, PowerPC, etc)
* - byte order endianness (big-endian or little-endian)
* - width of the integer and floating-point types (char, short, int, etc)
*/
/*
* Determine the target operating system type. This is used mainly in
* the implementation of operating system dependent runtime library
* functions (i.e. lib/os*.c), but also to handle some OS quirks in
* this include file.
*/
#ifdef _WIN32
#define ___OS_WIN32
#endif
/*
* Determine the target processor type. This is used for dynamic code
* generation (to convert Scheme procedures into C functions) and to
* determine byte order endianness.
*/
#ifndef ___CPU_x86
#ifdef I386
#define ___CPU_x86
#else
#ifdef _I386
#define ___CPU_x86
#else
#ifdef i386
#define ___CPU_x86
#else
#ifdef _i386
#define ___CPU_x86
#else
#ifdef __i386
#define ___CPU_x86
#else
#ifdef __i386__
#define ___CPU_x86
#else
#ifdef __i486
#define ___CPU_x86
#else
#ifdef __i486__
#define ___CPU_x86
#else
#ifdef __i586
#define ___CPU_x86
#else
#ifdef __i586__
#define ___CPU_x86
#else
#ifdef __i686
#define ___CPU_x86
#else
#ifdef __i686__
#define ___CPU_x86
#else
#ifdef __ix86
#define ___CPU_x86
#else
#ifdef M_I386
#define ___CPU_x86
#else
#ifdef _M_I386
#define ___CPU_x86
#else
#ifdef M_I86
#define ___CPU_x86
#else
#ifdef _M_I86
#define ___CPU_x86
#else
#ifdef _M_IX86
#define ___CPU_x86
#else
#ifdef _X86_
#define ___CPU_x86
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef ___CPU_x86_64
#ifdef __x86_64__
#define ___CPU_x86_64
#endif
#endif
#ifndef CPU_ppc
#ifdef PPC
#define ___CPU_ppc
#else
#ifdef ppc
#define ___CPU_ppc
#else
#ifdef __ppc
#define ___CPU_ppc
#else
#ifdef __ppc__
#define ___CPU_ppc
#else
#ifdef _ARCH_PPC
#define ___CPU_ppc
#else
#ifdef __POWERPC__
#define ___CPU_ppc
#else
#ifdef powerpc
#define ___CPU_ppc
#else
#ifdef _POWER
#define ___CPU_ppc
#else
#ifdef _ARCH_PWR
#define ___CPU_ppc
#else
#ifdef _ARCH_PWR2
#define ___CPU_ppc
#else
#ifdef _M_PPC
#define ___CPU_ppc
#else
#ifdef _M_MPPC
#define ___CPU_ppc
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef ___CPU_ppc_64
#ifdef __ppc_64__
#define ___CPU_ppc_64
#endif
#endif
#ifndef ___CPU_sparc
#ifdef SPARC
#define ___CPU_sparc
#else
#ifdef __sparc
#define ___CPU_sparc
#else
#ifdef __sparc__
#define ___CPU_sparc
#else
#ifdef sparc
#define ___CPU_sparc
#else
#ifdef sparc64
#define ___CPU_sparc
#else
#ifdef sparclite
#define ___CPU_sparc
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef ___CPU_alpha
#ifdef alpha
#define ___CPU_alpha
#else
#ifdef __alpha
#define ___CPU_alpha
#else
#ifdef __alpha__
#define ___CPU_alpha
#else
#ifdef ALPHA
#define ___CPU_alpha
#else
#ifdef _ALPHA_
#define ___CPU_alpha
#else
#ifdef __ALPHA
#define ___CPU_alpha
#else
#ifdef _M_ALPHA
#define ___CPU_alpha
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef ___CPU_mips
#ifdef mips
#define ___CPU_mips
#else
#ifdef _mips
#define ___CPU_mips
#else
#ifdef __mips
#define ___CPU_mips
#else
#ifdef __mips__
#define ___CPU_mips
#else
#ifdef MIPSEB
#define ___CPU_mips
#else
#ifdef _MIPSEB
#define ___CPU_mips
#else
#ifdef __MIPSEB
#define ___CPU_mips
#else
#ifdef __MIPSEB__
#define ___CPU_mips
#else
#ifdef MIPSEL
#define ___CPU_mips
#else
#ifdef _MIPSEL
#define ___CPU_mips
#else
#ifdef __MIPSEL
#define ___CPU_mips
#else
#ifdef __MIPSEL__
#define ___CPU_mips
#else
#ifdef _M_MRX000
#define ___CPU_mips
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifndef CPU_arm
#ifdef arm
#define ___CPU_arm
#else
#ifdef __arm
#define ___CPU_arm
#else
#ifdef __arm__
#define ___CPU_arm
#endif
#endif
#endif
#endif
#ifndef CPU_vax
#ifdef vax
#define ___CPU_vax
#else
#ifdef __vax
#define ___CPU_vax
#else
#ifdef __vax__
#define ___CPU_vax
#endif
#endif
#endif
#endif
/*
* Determine the byte order endianness based on the processor type.
* We assume that all processors are big-endian, except the x86, x86_64,
* alpha and vax. The PowerPC, MIPS and ARM can be either big-endian or
* little-endian so extra tests are needed.
*/
#ifndef ___BIG_ENDIAN
#ifndef ___LITTLE_ENDIAN
#ifdef ___CPU_x86
#define ___LITTLE_ENDIAN
#endif
#ifdef ___CPU_x86_64
#define ___LITTLE_ENDIAN
#endif
#ifdef ___CPU_ppc
#ifdef _LITTLE_ENDIAN
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN__
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN_DATA__
#define ___LITTLE_ENDIAN
#endif
#endif
#ifdef ___CPU_ppc_64
#ifdef _LITTLE_ENDIAN
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN__
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN_DATA__
#define ___LITTLE_ENDIAN
#endif
#endif
#ifdef ___CPU_alpha
#define ___LITTLE_ENDIAN
#endif
#ifdef ___CPU_mips
#ifdef _MIPSEL
#define ___LITTLE_ENDIAN
#endif
#endif
#ifdef ___CPU_arm
#ifdef _LITTLE_ENDIAN
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN__
#define ___LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN_DATA__
#define ___LITTLE_ENDIAN
#endif
#endif
#ifdef ___CPU_vax
#define ___LITTLE_ENDIAN
#endif
#ifndef ___LITTLE_ENDIAN
#define ___BIG_ENDIAN
#endif
#endif
#endif
/*
* Determine the number of bits in various integer and floating point
* types and define appropriate macros accordingly. The macro for a
* given type is not defined if the type is not supported by the C
* compiler or if it is not 8, 16, 32 or 64 bits wide.
*/
#ifndef ___CHAR_WIDTH
#ifdef ___DONT_HAVE_LIMITS_H
/*
* If the file "limits.h" is not available then the symbol
* ___DONT_HAVE_LIMITS_H must be defined (for example on the compiler's
* command line) and the following definitions will be used:
*/
#define ___CHAR_WIDTH 8 /* if needed, edit to suit your platform */
#define ___SHORT_WIDTH 16
#define ___INT_WIDTH 32
#define ___LONG_WIDTH 32
#ifdef __GNUC__
#define ___LONGLONG_WIDTH 64
#endif
#else
/*
* If the file "limits.h" is available then it contains macros
* defining the range of the integer types. The following
* preprocessor conditional definitions are written so that they will
* work regardless of the number of bits in the integer types
* supported by the compiler (many compilers for 32 bit machines give
* an error for C preprocessor expressions like ULONG_MAX >> 32 or
* ULLONG_MAX == 18446744073709551615UL). Some parentheses seem
* redundant, but they are required for MS Visual C/C++ whose
* preprocessor signals an error on: x >> 8 >> 8.
*/
#include <limits.h>
#ifdef UCHAR_MAX
#if (UCHAR_MAX & 255) == 255
#if (UCHAR_MAX >> 8) == 0
#define ___CHAR_WIDTH 8
#else
#if ((UCHAR_MAX >> 8) & 255) == 255
#if ((UCHAR_MAX >> 8) >> 8) == 0
#define ___CHAR_WIDTH 16
#else
#if (((UCHAR_MAX >> 8) >> 8) & 255) == 255
#if (((UCHAR_MAX >> 8) >> 8) >> 8) != 0
#if ((((UCHAR_MAX >> 8) >> 8) >> 8) & 255) == 255
#if ((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) == 0
#define ___CHAR_WIDTH 32
#else
#if (((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if (((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
#define ___CHAR_WIDTH 64
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifdef USHRT_MAX
#if (USHRT_MAX & 255) == 255
#if (USHRT_MAX >> 8) == 0
#define ___SHORT_WIDTH 8
#else
#if ((USHRT_MAX >> 8) & 255) == 255
#if ((USHRT_MAX >> 8) >> 8) == 0
#define ___SHORT_WIDTH 16
#else
#if (((USHRT_MAX >> 8) >> 8) & 255) == 255
#if (((USHRT_MAX >> 8) >> 8) >> 8) != 0
#if ((((USHRT_MAX >> 8) >> 8) >> 8) & 255) == 255
#if ((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) == 0
#define ___SHORT_WIDTH 32
#else
#if (((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if (((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
#define ___SHORT_WIDTH 64
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifdef UINT_MAX
#if (UINT_MAX & 255) == 255
#if (UINT_MAX >> 8) == 0
#define ___INT_WIDTH 8
#else
#if ((UINT_MAX >> 8) & 255) == 255
#if ((UINT_MAX >> 8) >> 8) == 0
#define ___INT_WIDTH 16
#else
#if (((UINT_MAX >> 8) >> 8) & 255) == 255
#if (((UINT_MAX >> 8) >> 8) >> 8) != 0
#if ((((UINT_MAX >> 8) >> 8) >> 8) & 255) == 255
#if ((((UINT_MAX >> 8) >> 8) >> 8) >> 8) == 0
#define ___INT_WIDTH 32
#else
#if (((((UINT_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if (((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
#define ___INT_WIDTH 64
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifdef ULONG_MAX
#if (ULONG_MAX & 255) == 255
#if (ULONG_MAX >> 8) == 0
#define ___LONG_WIDTH 8
#else
#if ((ULONG_MAX >> 8) & 255) == 255
#if ((ULONG_MAX >> 8) >> 8) == 0
#define ___LONG_WIDTH 16
#else
#if (((ULONG_MAX >> 8) >> 8) & 255) == 255
#if (((ULONG_MAX >> 8) >> 8) >> 8) != 0
#if ((((ULONG_MAX >> 8) >> 8) >> 8) & 255) == 255
#if ((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) == 0
#define ___LONG_WIDTH 32
#else
#if (((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if (((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
#define ___LONG_WIDTH 64
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#ifdef __GNUC__
#define ___LONGLONG_WIDTH 64
#else
/* Handle some non ISO C99 compilers that nevertheless support "long long". */
#ifndef ULLONG_MAX
#ifdef ULONGLONG_MAX
#define ULLONG_MAX ULONGLONG_MAX
#else
#ifdef ULONG_LONG_MAX
#define ULLONG_MAX ULONG_LONG_MAX
#endif
#endif
#endif
#ifdef ULLONG_MAX
#if (ULLONG_MAX & 255) == 255
#if (ULLONG_MAX >> 8) == 0
#define ___LONGLONG_WIDTH 8
#else
#if ((ULLONG_MAX >> 8) & 255) == 255
#if ((ULLONG_MAX >> 8) >> 8) == 0
#define ___LONGLONG_WIDTH 16
#else
#if (((ULLONG_MAX >> 8) >> 8) & 255) == 255
#if (((ULLONG_MAX >> 8) >> 8) >> 8) != 0
#if ((((ULLONG_MAX >> 8) >> 8) >> 8) & 255) == 255
#if ((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) == 0
#define ___LONGLONG_WIDTH 32
#else
#if (((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if (((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if (((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
#if ((((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
#if ((((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
#define ___LONGLONG_WIDTH 64
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
/*
* If the "long long" type is not supported, then substitute the type
* "long".
*/
#ifndef ___LONGLONG_WIDTH
#define ___LONGLONG_WIDTH ___LONG_WIDTH
#define ___LONGLONG long
#define ___ULONGLONG unsigned long
#else
#define ___LONGLONG long long
#define ___ULONGLONG unsigned long long
#endif
/*
* Some old C compilers do not support the "signed char" and "wchar_t"
* types. The following preprocessor directives allow these types to
* be redefined (such as on the C compiler's command line, in
* "config.h", ...).
*/
#ifndef ___SCHAR
#define ___SCHAR signed char
#endif
#ifndef ___WCHAR
#ifdef ___DONT_HAVE_WCHAR_H
/*
* If the file "wchar.h" is not available then the symbol
* ___DONT_HAVE_WCHAR_H must be defined (for example on the compiler's
* command line) and the following definitions will be used:
*/
#define ___WCHAR unsigned char
#define ___WCHAR_MIN 0
#define ___WCHAR_MAX ((1<<___CHAR_WIDTH)-1)
#else
/*
* If the file "wchar.h" is available then it should contain macros
* defining the range of the wchar_t type.
*/
#include <wchar.h>
#define ___WCHAR wchar_t
#ifdef WCHAR_MIN
#define ___WCHAR_MIN WCHAR_MIN
#else
#define ___WCHAR_MIN 0
#endif
#ifdef WCHAR_MAX
#define ___WCHAR_MAX WCHAR_MAX
#else
#ifdef UINT_MAX
#define ___WCHAR_MAX UINT_MAX
#else
#define ___WCHAR_MAX ((1<<___CHAR_WIDTH)-1)
#endif
#endif
#endif
#endif
#ifdef ___DONT_HAVE_FLOAT_H
/*
* If the file "float.h" is not available then the symbol
* ___DONT_HAVE_FLOAT_H must be defined (for example on the compiler's
* command line) and the following definitions will be used:
*/
#define ___FLOAT_WIDTH 32 /* if needed, edit to suit your platform */
#define ___DOUBLE_WIDTH 64
#else
/*
* If the file "float.h" is available then it contains macros defining
* the range of the floating point types. The following preprocessor
* conditional definitions are not completely correct (and may not
* even compile properly because it is possible that FLT_MAX_EXP and
* DBL_MAX_EXP are not constant expressions). However, it appears to
* work on a wide range of platforms.
*/
#include <float.h>
#ifdef FLT_MAX_EXP
#if FLT_MAX_EXP == 128
#define ___FLOAT_WIDTH 32
#else
#if FLT_MAX_EXP == 1024
#define ___FLOAT_WIDTH 64
#endif
#endif
#endif
#ifdef DBL_MAX_EXP
#if DBL_MAX_EXP == 128
#define ___DOUBLE_WIDTH 32
#else
#if DBL_MAX_EXP == 1024
#define ___DOUBLE_WIDTH 64
#endif
#endif
#endif
#endif
#endif
/*
* Size of pointers.
*
* ___VOIDSTAR_WIDTH must be equal to sizeof(void*) * ___CHAR_WIDTH.
* This value can't be computed with the "sizeof" operator because it
* must be known at macro expansion time. If in doubt just do
*
* #define ___VOIDSTAR_WIDTH ___LONG_WIDTH
*
*/
#ifndef ___VOIDSTAR_WIDTH
#define ___VOIDSTAR_WIDTH @CONF_VOIDSTAR_WIDTH@
#endif
#if ___VOIDSTAR_WIDTH == 32
#undef ___USE_32_BIT_ADDR
#define ___USE_32_BIT_ADDR
#endif
/*---------------------------------------------------------------------------*/
/*
* The following symbols must be defined to reflect the integer and
* floating-point data types supported by the C compiler. A symbol is
* only defined if the data type exists. At least ___F64 and one of
* the pairs ___S32/___U32 and ___S64/___U64 must be defined.
*
* define ___S8 as the signed integer type of exactly 8 bits
* define ___U8 as the unsigned integer type of exactly 8 bits
* define ___SM8 as the signed integer type of at least 8 bits
* define ___UM8 as the unsigned integer type of at least 8 bits
*
* define ___S16 as the signed integer type of exactly 16 bits
* define ___U16 as the unsigned integer type of exactly 16 bits
* define ___SM16 as the signed integer type of at least 16 bits
* define ___UM16 as the unsigned integer type of at least 16 bits
*
* define ___S32 as the signed integer type of exactly 32 bits
* define ___U32 as the unsigned integer type of exactly 32 bits
* define ___SM32 as the signed integer type of at least 32 bits
* define ___UM32 as the unsigned integer type of at least 32 bits
*
* define ___S64 as the signed integer type of exactly 64 bits
* define ___U64 as the unsigned integer type of exactly 64 bits
* define ___SM64 as the signed integer type of at least 64 bits
* define ___UM64 as the unsigned integer type of at least 64 bits
*
* define ___F32 as the 32 bit floating-point type
* define ___F64 as the 64 bit floating-point type
*/
/*
* First we make sure that the width of all the integer and
* floating-point types is known.
*/
#ifndef ___CHAR_WIDTH
@error "The definition for ___CHAR_WIDTH is missing"
#endif
#ifndef ___SHORT_WIDTH
@error "The definition for ___SHORT_WIDTH is missing"
#endif
#ifndef ___INT_WIDTH
@error "The definition for ___INT_WIDTH is missing"
#endif
#ifndef ___LONG_WIDTH
@error "The definition for ___LONG_WIDTH is missing"
#endif
#ifndef ___LONGLONG_WIDTH
@error "The definition for ___LONGLONG_WIDTH is missing"
#endif
#ifndef ___FLOAT_WIDTH
@error "The definition for ___FLOAT_WIDTH is missing"
#endif
#ifndef ___DOUBLE_WIDTH
@error "The definition for ___DOUBLE_WIDTH is missing"
#endif
#if ___INT_WIDTH == 8
#define ___S8 int
#define ___U8 unsigned int
#else
#if ___LONG_WIDTH == 8
#define ___S8 long
#define ___U8 unsigned long
#else
#if ___SHORT_WIDTH == 8
#define ___S8 short
#define ___U8 unsigned short
#else
#if ___CHAR_WIDTH == 8
#define ___S8 ___SCHAR
#define ___U8 unsigned char
#else
#if ___LONGLONG_WIDTH == 8
#define ___S8 ___LONGLONG
#define ___U8 unsigned ___LONGLONG
#endif
#endif
#endif
#endif
#endif
#if ___INT_WIDTH == 16
#define ___S16 int
#define ___U16 unsigned int
#else
#if ___LONG_WIDTH == 16
#define ___S16 long
#define ___U16 unsigned long
#else
#if ___SHORT_WIDTH == 16
#define ___S16 short
#define ___U16 unsigned short
#else
#if ___CHAR_WIDTH == 16
#define ___S16 ___SCHAR
#define ___U16 unsigned char
#else
#if ___LONGLONG_WIDTH == 16
#define ___S16 ___LONGLONG
#define ___U16 unsigned ___LONGLONG
#endif
#endif
#endif
#endif
#endif
#if ___INT_WIDTH == 32
#define ___S32 int
#define ___U32 unsigned int
#else
#if ___LONG_WIDTH == 32
#define ___S32 long
#define ___U32 unsigned long
#else
#if ___SHORT_WIDTH == 32
#define ___S32 short
#define ___U32 unsigned short
#else
#if ___CHAR_WIDTH == 32
#define ___S32 ___SCHAR
#define ___U32 unsigned char
#else
#if ___LONGLONG_WIDTH == 32
#define ___S32 ___LONGLONG
#define ___U32 unsigned ___LONGLONG
#endif
#endif
#endif
#endif
#endif
#if ___INT_WIDTH == 64
#define ___S64 int
#define ___U64 unsigned int
#else
#if ___LONG_WIDTH == 64
#define ___S64 long
#define ___U64 unsigned long
#else
#if ___SHORT_WIDTH == 64
#define ___S64 short
#define ___U64 unsigned short
#else
#if ___CHAR_WIDTH == 64
#define ___S64 ___SCHAR
#define ___U64 unsigned char
#else
#if ___LONGLONG_WIDTH == 64
#define ___S64 ___LONGLONG
#define ___U64 unsigned ___LONGLONG
#endif
#endif
#endif
#endif
#endif
#if ___FLOAT_WIDTH == 32
#define ___F32 float
#else
#if ___DOUBLE_WIDTH == 32
#define ___F32 double