OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-oscons-tmplt.c] - Blame information for rev 706

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
/*
2
------------------------------------------------------------------------------
3
--                                                                          --
4
--                         GNAT COMPILER COMPONENTS                         --
5
--                                                                          --
6
--                  S Y S T E M . O S _ C O N S T A N T S                   --
7
--                                                                          --
8
--                                 S p e c                                  --
9
--                                                                          --
10
--          Copyright (C) 2000-2011, Free Software Foundation, Inc.         --
11
--                                                                          --
12
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
-- GNAT was originally developed  by the GNAT team at  New York University. --
29
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
30
--                                                                          --
31
------------------------------------------------------------------------------
32
 
33
pragma Style_Checks ("M32766");
34
--  Allow long lines
35
 
36
*/
37
 
38
/**
39
 **  This template file is used while building the GNAT runtime library to
40
 **  generate package System.OS_Constants (s-oscons.ads).
41
 **
42
 **  The generation process is:
43
 **  1. the platform-independent extraction tool xoscons is built with the
44
 **     base native compiler
45
 **  2. this template is processed by the cross C compiler to produce
46
 **     a list of constant values
47
 **  3. the comments in this template and the list of values are processed
48
 **     by xoscons to generate s-oscons.ads.
49
 **
50
 **  Any comment occurring in this file whose start and end markers are on
51
 **  a line by themselves (see above) is copied verbatim to s-oscons.ads.
52
 **  All other comments are ignored. Note that the build process first passes
53
 **  this file through the C preprocessor, so comments that occur in a section
54
 **  that is conditioned by a #if directive will be copied to the output only
55
 **  when it applies.
56
 **
57
 **  Two methods are supported to generate the list of constant values,
58
 **  s-oscons-tmpl.s.
59
 **
60
 **  The default one assumes that the template can be compiled by the newly-
61
 **  built cross compiler. It uses markup produced in the (pseudo-)assembly
62
 **  listing:
63
 **
64
 **     xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
65
 **     xgcc -S s-oscons-tmplt.i
66
 **     xoscons
67
 **
68
 **  Alternatively, if s-oscons-tmplt.c must be compiled with a proprietary
69
 **  compiler (e.g. the native DEC CC on OpenVMS), the NATIVE macro should
70
 **  be defined, and the resulting program executed:
71
 **
72
 **  $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE)
73
 **      /PREPROCESS_ONLY /COMMENTS=AS_IS s-oscons-tmplt
74
 **  $ CC/DEFINE=("TARGET=""OpenVMS""",NATIVE) s-oscons-tmplt
75
 **  $ LINK s-oscons-tmplt
76
 **  $ DEFINE/USER SYS$OUTPUT s-oscons-tmplt.s
77
 **  $ RUN s-oscons-tmplt
78
 **  $ RUN xoscons
79
 **/
80
 
81
/* Feature macro definitions */
82
 
83
#if defined (__linux__) && !defined (_XOPEN_SOURCE)
84
/** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
85
 **/
86
#define _XOPEN_SOURCE 500
87
 
88
#elif defined (__alpha__) && defined (__osf__)
89
/** For Tru64 UNIX, _XOPEN_SOURCE must be defined, otherwise CLOCK_REALTIME
90
 ** is not defined.
91
 **/
92
#define _XOPEN_SOURCE 500
93
 
94
#elif defined (__mips) && defined (__sgi)
95
/** For IRIX 6, _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as
96
 ** IOV_MAX, otherwise IOV_MAX is not defined.  IRIX 5 has neither.
97
 **/
98
#ifdef _XOPEN_IOV_MAX
99
#define _XOPEN5
100
#define IOV_MAX _XOPEN_IOV_MAX
101
#endif
102
#endif
103
 
104
/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
105
 
106
#include "gsocket.h"
107
 
108
#include <stdlib.h>
109
#include <string.h>
110
#include <limits.h>
111
#include <fcntl.h>
112
#include <time.h>
113
 
114
#if defined (__alpha__) && defined (__osf__)
115
/** Tru64 is unable to do vector IO operations with default value of IOV_MAX,
116
 ** so its value is redefined to a small one which is known to work properly.
117
 **/
118
#undef IOV_MAX
119
#define IOV_MAX 16
120
#endif
121
 
122
#if defined (__VMS)
123
/** VMS is unable to do vector IO operations with default value of IOV_MAX,
124
 ** so its value is redefined to a small one which is known to work properly.
125
 **/
126
#undef IOV_MAX
127
#define IOV_MAX 16
128
#endif
129
 
130
#if ! (defined (__vxworks) || defined (__VMS) || defined (__MINGW32__) || \
131
       defined (__nucleus__))
132
# define HAVE_TERMIOS
133
#endif
134
 
135
#if defined (__vxworks)
136
 
137
/**
138
 ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
139
 ** the case of runtime libraries that support sockets).
140
 **/
141
 
142
# include <vxWorks.h>
143
#endif
144
 
145
#ifdef DUMMY
146
 
147
# if defined (TARGET)
148
#   error TARGET may not be defined when generating the dummy version
149
# else
150
#   define TARGET "batch runtime compilation (dummy values)"
151
# endif
152
 
153
# if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
154
#   error Features missing on platform
155
# endif
156
 
157
# define NATIVE
158
 
159
#endif /* DUMMY */
160
 
161
#ifndef TARGET
162
# error Please define TARGET
163
#endif
164
 
165
#ifndef HAVE_SOCKETS
166
# include <errno.h>
167
#endif
168
 
169
#ifdef HAVE_TERMIOS
170
# include <termios.h>
171
#endif
172
 
173
#ifdef __APPLE__
174
# include <_types.h>
175
#endif
176
 
177
#ifdef __linux__
178
# include <pthread.h>
179
# include <signal.h>
180
#endif
181
 
182
#ifdef NATIVE
183
#include <stdio.h>
184
 
185
#ifdef DUMMY
186
int counter = 0;
187
# define _VAL(x) counter++
188
#else
189
# define _VAL(x) x
190
#endif
191
 
192
#define CND(name,comment) \
193
  printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
194
 
195
#define CNS(name,comment) \
196
  printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
197
 
198
#define C(sname,type,value,comment)\
199
  printf ("\n->C:$%d:" sname ":" #type ":" value ":" comment, __LINE__);
200
 
201
#define TXT(text) \
202
  printf ("\n->TXT:$%d:" text, __LINE__);
203
 
204
#else
205
 
206
#define CND(name, comment) \
207
  asm volatile("\n->CND:%0:" #name ":%1:" comment \
208
  : : "i" (__LINE__), "i" ((int) name));
209
/* Decimal constant in the range of type "int" */
210
 
211
#define CNS(name, comment) \
212
  asm volatile("\n->CNS:%0:" #name ":" name ":" comment \
213
  : : "i" (__LINE__));
214
/* General expression named number */
215
 
216
#define C(sname, type, value, comment) \
217
  asm volatile("\n->C:%0:" sname ":" #type ":" value ":" comment \
218
  : : "i" (__LINE__));
219
/* Typed constant */
220
 
221
#define TXT(text) \
222
  asm volatile("\n->TXT:%0:" text \
223
  : : "i" (__LINE__));
224
/* Freeform text */
225
 
226
#endif /* NATIVE */
227
 
228
#define CST(name,comment) C(#name,String,name,comment)
229
 
230
#define STR(x) STR1(x)
231
#define STR1(x) #x
232
 
233
#ifdef __MINGW32__
234
unsigned int _CRT_fmode = _O_BINARY;
235
#endif
236
 
237
int
238
main (void) {
239
 
240
/*
241
--  This package provides target dependent definitions of constant for use
242
--  by the GNAT runtime library. This package should not be directly with'd
243
--  by an application program.
244
 
245
--  This file is generated automatically, do not modify it by hand! Instead,
246
--  make changes to s-oscons-tmplt.c and rebuild the GNAT runtime library.
247
*/
248
 
249
/**
250
 ** Do not change the format of the line below without also updating the
251
 ** MaRTE Makefile.
252
 **/
253
TXT("--  This is the version for " TARGET)
254
TXT("")
255
 
256
#ifdef HAVE_SOCKETS
257
/**
258
 **  The type definitions for struct hostent components uses Interfaces.C
259
 **/
260
 
261
TXT("with Interfaces.C;")
262
#endif
263
 
264
/*
265
package System.OS_Constants is
266
 
267
   pragma Pure;
268
*/
269
 
270
/**
271
 **  General constants (all platforms)
272
 **/
273
 
274
/*
275
 
276
   -----------------------------
277
   -- Platform identification --
278
   -----------------------------
279
 
280
   type OS_Type is (Windows, VMS, Other_OS);
281
*/
282
#if defined (__MINGW32__)
283
# define TARGET_OS "Windows"
284
#elif defined (__VMS)
285
# define TARGET_OS "VMS"
286
#else
287
# define TARGET_OS "Other_OS"
288
#endif
289
C("Target_OS", OS_Type, TARGET_OS, "")
290
#define Target_Name TARGET
291
CST(Target_Name, "")
292
/*
293
 
294
   -------------------
295
   -- System limits --
296
   -------------------
297
 
298
*/
299
 
300
#ifndef IOV_MAX
301
# define IOV_MAX INT_MAX
302
#endif
303
CND(IOV_MAX, "Maximum writev iovcnt")
304
 
305
/*
306
 
307
   ---------------------
308
   -- File open modes --
309
   ---------------------
310
 
311
*/
312
 
313
#ifndef O_RDWR
314
# define O_RDWR -1
315
#endif
316
CND(O_RDWR, "Read/write")
317
 
318
#ifndef O_NOCTTY
319
# define O_NOCTTY -1
320
#endif
321
CND(O_NOCTTY, "Don't change ctrl tty")
322
 
323
#ifndef O_NDELAY
324
# define O_NDELAY -1
325
#endif
326
CND(O_NDELAY, "Nonblocking")
327
 
328
/*
329
 
330
   ----------------------
331
   -- Fcntl operations --
332
   ----------------------
333
 
334
*/
335
 
336
#ifndef F_GETFL
337
# define F_GETFL -1
338
#endif
339
CND(F_GETFL, "Get flags")
340
 
341
#ifndef F_SETFL
342
# define F_SETFL -1
343
#endif
344
CND(F_SETFL, "Set flags")
345
 
346
/*
347
 
348
   -----------------
349
   -- Fcntl flags --
350
   -----------------
351
 
352
*/
353
 
354
#ifndef FNDELAY
355
# define FNDELAY -1
356
#endif
357
CND(FNDELAY, "Nonblocking")
358
 
359
/*
360
 
361
   ----------------------
362
   -- Ioctl operations --
363
   ----------------------
364
 
365
*/
366
 
367
#ifndef FIONBIO
368
# define FIONBIO -1
369
#endif
370
CND(FIONBIO, "Set/clear non-blocking io")
371
 
372
#ifndef FIONREAD
373
# define FIONREAD -1
374
#endif
375
CND(FIONREAD, "How many bytes to read")
376
 
377
/*
378
 
379
   ------------------
380
   -- Errno values --
381
   ------------------
382
 
383
   --  The following constants are defined from <errno.h>
384
 
385
*/
386
#ifndef EAGAIN
387
# define EAGAIN -1
388
#endif
389
CND(EAGAIN, "Try again")
390
 
391
#ifndef ENOENT
392
# define ENOENT -1
393
#endif
394
CND(ENOENT, "File not found")
395
 
396
#ifndef ENOMEM
397
# define ENOMEM -1
398
#endif
399
CND(ENOMEM, "Out of memory")
400
 
401
#ifdef __MINGW32__
402
/*
403
 
404
   --  The following constants are defined from <winsock2.h> (WSA*)
405
 
406
*/
407
 
408
/**
409
 **  For sockets-related errno values on Windows, gsocket.h redefines
410
 **  Exxx as WSAExxx.
411
 **/
412
 
413
#endif
414
 
415
#ifndef EACCES
416
# define EACCES -1
417
#endif
418
CND(EACCES, "Permission denied")
419
 
420
#ifndef EADDRINUSE
421
# define EADDRINUSE -1
422
#endif
423
CND(EADDRINUSE, "Address already in use")
424
 
425
#ifndef EADDRNOTAVAIL
426
# define EADDRNOTAVAIL -1
427
#endif
428
CND(EADDRNOTAVAIL, "Cannot assign address")
429
 
430
#ifndef EAFNOSUPPORT
431
# define EAFNOSUPPORT -1
432
#endif
433
CND(EAFNOSUPPORT, "Addr family not supported")
434
 
435
#ifndef EALREADY
436
# define EALREADY -1
437
#endif
438
CND(EALREADY, "Operation in progress")
439
 
440
#ifndef EBADF
441
# define EBADF -1
442
#endif
443
CND(EBADF, "Bad file descriptor")
444
 
445
#ifndef ECONNABORTED
446
# define ECONNABORTED -1
447
#endif
448
CND(ECONNABORTED, "Connection aborted")
449
 
450
#ifndef ECONNREFUSED
451
# define ECONNREFUSED -1
452
#endif
453
CND(ECONNREFUSED, "Connection refused")
454
 
455
#ifndef ECONNRESET
456
# define ECONNRESET -1
457
#endif
458
CND(ECONNRESET, "Connection reset by peer")
459
 
460
#ifndef EDESTADDRREQ
461
# define EDESTADDRREQ -1
462
#endif
463
CND(EDESTADDRREQ, "Destination addr required")
464
 
465
#ifndef EFAULT
466
# define EFAULT -1
467
#endif
468
CND(EFAULT, "Bad address")
469
 
470
#ifndef EHOSTDOWN
471
# define EHOSTDOWN -1
472
#endif
473
CND(EHOSTDOWN, "Host is down")
474
 
475
#ifndef EHOSTUNREACH
476
# define EHOSTUNREACH -1
477
#endif
478
CND(EHOSTUNREACH, "No route to host")
479
 
480
#ifndef EINPROGRESS
481
# define EINPROGRESS -1
482
#endif
483
CND(EINPROGRESS, "Operation now in progress")
484
 
485
#ifndef EINTR
486
# define EINTR -1
487
#endif
488
CND(EINTR, "Interrupted system call")
489
 
490
#ifndef EINVAL
491
# define EINVAL -1
492
#endif
493
CND(EINVAL, "Invalid argument")
494
 
495
#ifndef EIO
496
# define EIO -1
497
#endif
498
CND(EIO, "Input output error")
499
 
500
#ifndef EISCONN
501
# define EISCONN -1
502
#endif
503
CND(EISCONN, "Socket already connected")
504
 
505
#ifndef ELOOP
506
# define ELOOP -1
507
#endif
508
CND(ELOOP, "Too many symbolic links")
509
 
510
#ifndef EMFILE
511
# define EMFILE -1
512
#endif
513
CND(EMFILE, "Too many open files")
514
 
515
#ifndef EMSGSIZE
516
# define EMSGSIZE -1
517
#endif
518
CND(EMSGSIZE, "Message too long")
519
 
520
#ifndef ENAMETOOLONG
521
# define ENAMETOOLONG -1
522
#endif
523
CND(ENAMETOOLONG, "Name too long")
524
 
525
#ifndef ENETDOWN
526
# define ENETDOWN -1
527
#endif
528
CND(ENETDOWN, "Network is down")
529
 
530
#ifndef ENETRESET
531
# define ENETRESET -1
532
#endif
533
CND(ENETRESET, "Disconn. on network reset")
534
 
535
#ifndef ENETUNREACH
536
# define ENETUNREACH -1
537
#endif
538
CND(ENETUNREACH, "Network is unreachable")
539
 
540
#ifndef ENOBUFS
541
# define ENOBUFS -1
542
#endif
543
CND(ENOBUFS, "No buffer space available")
544
 
545
#ifndef ENOPROTOOPT
546
# define ENOPROTOOPT -1
547
#endif
548
CND(ENOPROTOOPT, "Protocol not available")
549
 
550
#ifndef ENOTCONN
551
# define ENOTCONN -1
552
#endif
553
CND(ENOTCONN, "Socket not connected")
554
 
555
#ifndef ENOTSOCK
556
# define ENOTSOCK -1
557
#endif
558
CND(ENOTSOCK, "Operation on non socket")
559
 
560
#ifndef EOPNOTSUPP
561
# define EOPNOTSUPP -1
562
#endif
563
CND(EOPNOTSUPP, "Operation not supported")
564
 
565
#ifndef EPIPE
566
# define EPIPE -1
567
#endif
568
CND(EPIPE, "Broken pipe")
569
 
570
#ifndef EPFNOSUPPORT
571
# define EPFNOSUPPORT -1
572
#endif
573
CND(EPFNOSUPPORT, "Unknown protocol family")
574
 
575
#ifndef EPROTONOSUPPORT
576
# define EPROTONOSUPPORT -1
577
#endif
578
CND(EPROTONOSUPPORT, "Unknown protocol")
579
 
580
#ifndef EPROTOTYPE
581
# define EPROTOTYPE -1
582
#endif
583
CND(EPROTOTYPE, "Unknown protocol type")
584
 
585
#ifndef ERANGE
586
# define ERANGE -1
587
#endif
588
CND(ERANGE, "Result too large")
589
 
590
#ifndef ESHUTDOWN
591
# define ESHUTDOWN -1
592
#endif
593
CND(ESHUTDOWN, "Cannot send once shutdown")
594
 
595
#ifndef ESOCKTNOSUPPORT
596
# define ESOCKTNOSUPPORT -1
597
#endif
598
CND(ESOCKTNOSUPPORT, "Socket type not supported")
599
 
600
#ifndef ETIMEDOUT
601
# define ETIMEDOUT -1
602
#endif
603
CND(ETIMEDOUT, "Connection timed out")
604
 
605
#ifndef ETOOMANYREFS
606
# define ETOOMANYREFS -1
607
#endif
608
CND(ETOOMANYREFS, "Too many references")
609
 
610
#ifndef EWOULDBLOCK
611
# define EWOULDBLOCK -1
612
#endif
613
CND(EWOULDBLOCK, "Operation would block")
614
 
615
/**
616
 **  Terminal I/O constants
617
 **/
618
 
619
#ifdef HAVE_TERMIOS
620
 
621
/*
622
 
623
   ----------------------
624
   -- Terminal control --
625
   ----------------------
626
 
627
*/
628
 
629
#ifndef TCSANOW
630
# define TCSANOW -1
631
#endif
632
CND(TCSANOW, "Immediate")
633
 
634
#ifndef TCIFLUSH
635
# define TCIFLUSH -1
636
#endif
637
CND(TCIFLUSH, "Flush input")
638
 
639
#ifndef CLOCAL
640
# define CLOCAL -1
641
#endif
642
CND(CLOCAL, "Local")
643
 
644
#ifndef CRTSCTS
645
# define CRTSCTS -1
646
#endif
647
CND(CRTSCTS, "Hardware flow control")
648
 
649
#ifndef CREAD
650
# define CREAD -1
651
#endif
652
CND(CREAD, "Read")
653
 
654
#ifndef CS5
655
# define CS5 -1
656
#endif
657
CND(CS5, "5 data bits")
658
 
659
#ifndef CS6
660
# define CS6 -1
661
#endif
662
CND(CS6, "6 data bits")
663
 
664
#ifndef CS7
665
# define CS7 -1
666
#endif
667
CND(CS7, "7 data bits")
668
 
669
#ifndef CS8
670
# define CS8 -1
671
#endif
672
CND(CS8, "8 data bits")
673
 
674
#ifndef CSTOPB
675
# define CSTOPB -1
676
#endif
677
CND(CSTOPB, "2 stop bits")
678
 
679
#ifndef PARENB
680
# define PARENB -1
681
#endif
682
CND(PARENB, "Parity enable")
683
 
684
#ifndef PARODD
685
# define PARODD -1
686
#endif
687
CND(PARODD, "Parity odd")
688
 
689
#ifndef B0
690
# define B0 -1
691
#endif
692
CND(B0, "0 bps")
693
 
694
#ifndef B50
695
# define B50 -1
696
#endif
697
CND(B50, "50 bps")
698
 
699
#ifndef B75
700
# define B75 -1
701
#endif
702
CND(B75, "75 bps")
703
 
704
#ifndef B110
705
# define B110 -1
706
#endif
707
CND(B110, "110 bps")
708
 
709
#ifndef B134
710
# define B134 -1
711
#endif
712
CND(B134, "134 bps")
713
 
714
#ifndef B150
715
# define B150 -1
716
#endif
717
CND(B150, "150 bps")
718
 
719
#ifndef B200
720
# define B200 -1
721
#endif
722
CND(B200, "200 bps")
723
 
724
#ifndef B300
725
# define B300 -1
726
#endif
727
CND(B300, "300 bps")
728
 
729
#ifndef B600
730
# define B600 -1
731
#endif
732
CND(B600, "600 bps")
733
 
734
#ifndef B1200
735
# define B1200 -1
736
#endif
737
CND(B1200, "1200 bps")
738
 
739
#ifndef B1800
740
# define B1800 -1
741
#endif
742
CND(B1800, "1800 bps")
743
 
744
#ifndef B2400
745
# define B2400 -1
746
#endif
747
CND(B2400, "2400 bps")
748
 
749
#ifndef B4800
750
# define B4800 -1
751
#endif
752
CND(B4800, "4800 bps")
753
 
754
#ifndef B9600
755
# define B9600 -1
756
#endif
757
CND(B9600, "9600 bps")
758
 
759
#ifndef B19200
760
# define B19200 -1
761
#endif
762
CND(B19200, "19200 bps")
763
 
764
#ifndef B38400
765
# define B38400 -1
766
#endif
767
CND(B38400, "38400 bps")
768
 
769
#ifndef B57600
770
# define B57600 -1
771
#endif
772
CND(B57600, "57600 bps")
773
 
774
#ifndef B115200
775
# define B115200 -1
776
#endif
777
CND(B115200, "115200 bps")
778
 
779
#ifndef B230400
780
# define B230400 -1
781
#endif
782
CND(B230400, "230400 bps")
783
 
784
#ifndef B460800
785
# define B460800 -1
786
#endif
787
CND(B460800, "460800 bps")
788
 
789
#ifndef B500000
790
# define B500000 -1
791
#endif
792
CND(B500000, "500000 bps")
793
 
794
#ifndef B576000
795
# define B576000 -1
796
#endif
797
CND(B576000, "576000 bps")
798
 
799
#ifndef B921600
800
# define B921600 -1
801
#endif
802
CND(B921600, "921600 bps")
803
 
804
#ifndef B1000000
805
# define B1000000 -1
806
#endif
807
CND(B1000000, "1000000 bps")
808
 
809
#ifndef B1152000
810
# define B1152000 -1
811
#endif
812
CND(B1152000, "1152000 bps")
813
 
814
#ifndef B1500000
815
# define B1500000 -1
816
#endif
817
CND(B1500000, "1500000 bps")
818
 
819
#ifndef B2000000
820
# define B2000000 -1
821
#endif
822
CND(B2000000, "2000000 bps")
823
 
824
#ifndef B2500000
825
# define B2500000 -1
826
#endif
827
CND(B2500000, "2500000 bps")
828
 
829
#ifndef B3000000
830
# define B3000000 -1
831
#endif
832
CND(B3000000, "3000000 bps")
833
 
834
#ifndef B3500000
835
# define B3500000 -1
836
#endif
837
CND(B3500000, "3500000 bps")
838
 
839
#ifndef B4000000
840
# define B4000000 -1
841
#endif
842
CND(B4000000, "4000000 bps")
843
 
844
/*
845
 
846
   ---------------------------------
847
   -- Terminal control characters --
848
   ---------------------------------
849
 
850
*/
851
 
852
#ifndef VINTR
853
# define VINTR -1
854
#endif
855
CND(VINTR, "Interrupt")
856
 
857
#ifndef VQUIT
858
# define VQUIT -1
859
#endif
860
CND(VQUIT, "Quit")
861
 
862
#ifndef VERASE
863
# define VERASE -1
864
#endif
865
CND(VERASE, "Erase")
866
 
867
#ifndef VKILL
868
# define VKILL -1
869
#endif
870
CND(VKILL, "Kill")
871
 
872
#ifndef VEOF
873
# define VEOF -1
874
#endif
875
CND(VEOF, "EOF")
876
 
877
#ifndef VTIME
878
# define VTIME -1
879
#endif
880
CND(VTIME, "Read timeout")
881
 
882
#ifndef VMIN
883
# define VMIN -1
884
#endif
885
CND(VMIN, "Read min chars")
886
 
887
#ifndef VSWTC
888
# define VSWTC -1
889
#endif
890
CND(VSWTC, "Switch")
891
 
892
#ifndef VSTART
893
# define VSTART -1
894
#endif
895
CND(VSTART, "Flow control start")
896
 
897
#ifndef VSTOP
898
# define VSTOP -1
899
#endif
900
CND(VSTOP, "Flow control stop")
901
 
902
#ifndef VSUSP
903
# define VSUSP -1
904
#endif
905
CND(VSUSP, "Suspend")
906
 
907
#ifndef VEOL
908
# define VEOL -1
909
#endif
910
CND(VEOL, "EOL")
911
 
912
#ifndef VREPRINT
913
# define VREPRINT -1
914
#endif
915
CND(VREPRINT, "Reprint unread")
916
 
917
#ifndef VDISCARD
918
# define VDISCARD -1
919
#endif
920
CND(VDISCARD, "Discard pending")
921
 
922
#ifndef VWERASE
923
# define VWERASE -1
924
#endif
925
CND(VWERASE, "Word erase")
926
 
927
#ifndef VLNEXT
928
# define VLNEXT -1
929
#endif
930
CND(VLNEXT, "Literal next")
931
 
932
#ifndef VEOL2
933
# define VEOL2 -1
934
#endif
935
CND(VEOL2, "Alternative EOL")
936
 
937
#endif /* HAVE_TERMIOS */
938
 
939
/*
940
 
941
   -----------------------------
942
   -- Pseudo terminal library --
943
   -----------------------------
944
 
945
*/
946
 
947
#if defined (__FreeBSD__) || defined (linux)
948
# define PTY_Library "-lutil"
949
#else
950
# define PTY_Library ""
951
#endif
952
CST(PTY_Library, "for g-exptty")
953
 
954
/**
955
 **  Sockets constants
956
 **/
957
 
958
#ifdef HAVE_SOCKETS
959
 
960
/*
961
 
962
   --------------
963
   -- Families --
964
   --------------
965
 
966
*/
967
 
968
#ifndef AF_INET
969
# define AF_INET -1
970
#endif
971
CND(AF_INET, "IPv4 address family")
972
 
973
/**
974
 ** RTEMS lies and defines AF_INET6 even though there is no IPV6 support.
975
 ** Its TCP/IP stack is in transition.  It has newer .h files but no IPV6 yet.
976
 **/
977
#if defined(__rtems__)
978
# undef AF_INET6
979
#endif
980
 
981
/**
982
 ** Tru64 UNIX V4.0F defines AF_INET6 without IPv6 support, specifically
983
 ** without struct sockaddr_in6.  We use _SS_MAXSIZE (used for the definition
984
 ** of struct sockaddr_storage on Tru64 UNIX V5.1) to detect this.
985
 **/
986
#if defined(__osf__) && !defined(_SS_MAXSIZE)
987
# undef AF_INET6
988
#endif
989
 
990
#ifndef AF_INET6
991
# define AF_INET6 -1
992
#else
993
# define HAVE_AF_INET6 1
994
#endif
995
CND(AF_INET6, "IPv6 address family")
996
 
997
/*
998
 
999
   ------------------
1000
   -- Socket modes --
1001
   ------------------
1002
 
1003
*/
1004
 
1005
#ifndef SOCK_STREAM
1006
# define SOCK_STREAM -1
1007
#endif
1008
CND(SOCK_STREAM, "Stream socket")
1009
 
1010
#ifndef SOCK_DGRAM
1011
# define SOCK_DGRAM -1
1012
#endif
1013
CND(SOCK_DGRAM, "Datagram socket")
1014
 
1015
/*
1016
 
1017
   -----------------
1018
   -- Host errors --
1019
   -----------------
1020
 
1021
*/
1022
 
1023
#ifndef HOST_NOT_FOUND
1024
# define HOST_NOT_FOUND -1
1025
#endif
1026
CND(HOST_NOT_FOUND, "Unknown host")
1027
 
1028
#ifndef TRY_AGAIN
1029
# define TRY_AGAIN -1
1030
#endif
1031
CND(TRY_AGAIN, "Host name lookup failure")
1032
 
1033
#ifndef NO_DATA
1034
# define NO_DATA -1
1035
#endif
1036
CND(NO_DATA, "No data record for name")
1037
 
1038
#ifndef NO_RECOVERY
1039
# define NO_RECOVERY -1
1040
#endif
1041
CND(NO_RECOVERY, "Non recoverable errors")
1042
 
1043
/*
1044
 
1045
   --------------------
1046
   -- Shutdown modes --
1047
   --------------------
1048
 
1049
*/
1050
 
1051
#ifndef SHUT_RD
1052
# define SHUT_RD -1
1053
#endif
1054
CND(SHUT_RD, "No more recv")
1055
 
1056
#ifndef SHUT_WR
1057
# define SHUT_WR -1
1058
#endif
1059
CND(SHUT_WR, "No more send")
1060
 
1061
#ifndef SHUT_RDWR
1062
# define SHUT_RDWR -1
1063
#endif
1064
CND(SHUT_RDWR, "No more recv/send")
1065
 
1066
/*
1067
 
1068
   ---------------------
1069
   -- Protocol levels --
1070
   ---------------------
1071
 
1072
*/
1073
 
1074
#ifndef SOL_SOCKET
1075
# define SOL_SOCKET -1
1076
#endif
1077
CND(SOL_SOCKET, "Options for socket level")
1078
 
1079
#ifndef IPPROTO_IP
1080
# define IPPROTO_IP -1
1081
#endif
1082
CND(IPPROTO_IP, "Dummy protocol for IP")
1083
 
1084
#ifndef IPPROTO_UDP
1085
# define IPPROTO_UDP -1
1086
#endif
1087
CND(IPPROTO_UDP, "UDP")
1088
 
1089
#ifndef IPPROTO_TCP
1090
# define IPPROTO_TCP -1
1091
#endif
1092
CND(IPPROTO_TCP, "TCP")
1093
 
1094
/*
1095
 
1096
   -------------------
1097
   -- Request flags --
1098
   -------------------
1099
 
1100
*/
1101
 
1102
#ifndef MSG_OOB
1103
# define MSG_OOB -1
1104
#endif
1105
CND(MSG_OOB, "Process out-of-band data")
1106
 
1107
#ifndef MSG_PEEK
1108
# define MSG_PEEK -1
1109
#endif
1110
CND(MSG_PEEK, "Peek at incoming data")
1111
 
1112
#ifndef MSG_EOR
1113
# define MSG_EOR -1
1114
#endif
1115
CND(MSG_EOR, "Send end of record")
1116
 
1117
#ifndef MSG_WAITALL
1118
#ifdef __MINWGW32__
1119
/* The value of MSG_WAITALL is 8.  Nevertheless winsock.h doesn't
1120
   define it, but it is still usable as we link to winsock2 API.  */
1121
# define MSG_WAITALL (1 << 3)
1122
#else
1123
# define MSG_WAITALL -1
1124
#endif
1125
#endif
1126
CND(MSG_WAITALL, "Wait for full reception")
1127
 
1128
#ifndef MSG_NOSIGNAL
1129
# define MSG_NOSIGNAL -1
1130
#endif
1131
CND(MSG_NOSIGNAL, "No SIGPIPE on send")
1132
 
1133
#ifdef __linux__
1134
# define MSG_Forced_Flags "MSG_NOSIGNAL"
1135
#else
1136
# define MSG_Forced_Flags "0"
1137
#endif
1138
CNS(MSG_Forced_Flags, "")
1139
/*
1140
   --  Flags set on all send(2) calls
1141
*/
1142
 
1143
/*
1144
 
1145
   --------------------
1146
   -- Socket options --
1147
   --------------------
1148
 
1149
*/
1150
 
1151
#ifndef TCP_NODELAY
1152
# define TCP_NODELAY -1
1153
#endif
1154
CND(TCP_NODELAY, "Do not coalesce packets")
1155
 
1156
#ifndef SO_REUSEADDR
1157
# define SO_REUSEADDR -1
1158
#endif
1159
CND(SO_REUSEADDR, "Bind reuse local address")
1160
 
1161
#ifndef SO_REUSEPORT
1162
# define SO_REUSEPORT -1
1163
#endif
1164
CND(SO_REUSEPORT, "Bind reuse port number")
1165
 
1166
#ifndef SO_KEEPALIVE
1167
# define SO_KEEPALIVE -1
1168
#endif
1169
CND(SO_KEEPALIVE, "Enable keep-alive msgs")
1170
 
1171
#ifndef SO_LINGER
1172
# define SO_LINGER -1
1173
#endif
1174
CND(SO_LINGER, "Defer close to flush data")
1175
 
1176
#ifndef SO_BROADCAST
1177
# define SO_BROADCAST -1
1178
#endif
1179
CND(SO_BROADCAST, "Can send broadcast msgs")
1180
 
1181
#ifndef SO_SNDBUF
1182
# define SO_SNDBUF -1
1183
#endif
1184
CND(SO_SNDBUF, "Set/get send buffer size")
1185
 
1186
#ifndef SO_RCVBUF
1187
# define SO_RCVBUF -1
1188
#endif
1189
CND(SO_RCVBUF, "Set/get recv buffer size")
1190
 
1191
#ifndef SO_SNDTIMEO
1192
# define SO_SNDTIMEO -1
1193
#endif
1194
CND(SO_SNDTIMEO, "Emission timeout")
1195
 
1196
#ifndef SO_RCVTIMEO
1197
# define SO_RCVTIMEO -1
1198
#endif
1199
CND(SO_RCVTIMEO, "Reception timeout")
1200
 
1201
#ifndef SO_ERROR
1202
# define SO_ERROR -1
1203
#endif
1204
CND(SO_ERROR, "Get/clear error status")
1205
 
1206
#ifndef IP_MULTICAST_IF
1207
# define IP_MULTICAST_IF -1
1208
#endif
1209
CND(IP_MULTICAST_IF, "Set/get mcast interface")
1210
 
1211
#ifndef IP_MULTICAST_TTL
1212
# define IP_MULTICAST_TTL -1
1213
#endif
1214
CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
1215
 
1216
#ifndef IP_MULTICAST_LOOP
1217
# define IP_MULTICAST_LOOP -1
1218
#endif
1219
CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
1220
 
1221
#ifndef IP_ADD_MEMBERSHIP
1222
# define IP_ADD_MEMBERSHIP -1
1223
#endif
1224
CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
1225
 
1226
#ifndef IP_DROP_MEMBERSHIP
1227
# define IP_DROP_MEMBERSHIP -1
1228
#endif
1229
CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
1230
 
1231
#ifndef IP_PKTINFO
1232
# define IP_PKTINFO -1
1233
#endif
1234
CND(IP_PKTINFO, "Get datagram info")
1235
 
1236
/*
1237
 
1238
   ----------------------
1239
   -- Type definitions --
1240
   ----------------------
1241
 
1242
*/
1243
 
1244
{
1245
  struct timeval tv;
1246
/*
1247
   --  Sizes (in bytes) of the components of struct timeval
1248
*/
1249
#define SIZEOF_tv_sec (sizeof tv.tv_sec)
1250
CND(SIZEOF_tv_sec, "tv_sec")
1251
#define SIZEOF_tv_usec (sizeof tv.tv_usec)
1252
CND(SIZEOF_tv_usec, "tv_usec")
1253
/*
1254
 
1255
   --  Maximum allowed value for tv_sec
1256
*/
1257
 
1258
/**
1259
 ** On Solaris and IRIX, field tv_sec in struct timeval has an undocumented
1260
 ** hard-wired limit of 100 million.
1261
 ** On IA64 HP-UX the limit is 2**31 - 1.
1262
 **/
1263
#if defined (sun) || (defined (__mips) && defined (__sgi))
1264
# define MAX_tv_sec "100_000_000"
1265
 
1266
#elif defined (__hpux__)
1267
# define MAX_tv_sec "16#7fffffff#"
1268
 
1269
#else
1270
# define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
1271
#endif
1272
CNS(MAX_tv_sec, "")
1273
}
1274
/*
1275
 
1276
   --  Sizes of various data types
1277
*/
1278
 
1279
#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
1280
CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
1281
#ifdef HAVE_AF_INET6
1282
# define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
1283
#else
1284
# define SIZEOF_sockaddr_in6 0
1285
#endif
1286
CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
1287
 
1288
#define SIZEOF_fd_set (sizeof (fd_set))
1289
CND(SIZEOF_fd_set, "fd_set");
1290
CND(FD_SETSIZE, "Max fd value");
1291
 
1292
#define SIZEOF_struct_hostent (sizeof (struct hostent))
1293
CND(SIZEOF_struct_hostent, "struct hostent");
1294
 
1295
#define SIZEOF_struct_servent (sizeof (struct servent))
1296
CND(SIZEOF_struct_servent, "struct servent");
1297
 
1298
#if defined (__linux__)
1299
#define SIZEOF_sigset (sizeof (sigset_t))
1300
CND(SIZEOF_sigset, "sigset");
1301
#endif
1302
/*
1303
 
1304
   --  Fields of struct msghdr
1305
*/
1306
 
1307
#if defined (__sun__) || defined (__hpux__)
1308
# define msg_iovlen_t "int"
1309
#else
1310
# define msg_iovlen_t "size_t"
1311
#endif
1312
 
1313
TXT("   subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
1314
 
1315
/*
1316
 
1317
   ----------------------------------------
1318
   -- Properties of supported interfaces --
1319
   ----------------------------------------
1320
 
1321
*/
1322
 
1323
CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
1324
CND(Need_Netdb_Lock,   "Need lock for Netdb ops")
1325
CND(Has_Sockaddr_Len,  "Sockaddr has sa_len field")
1326
 
1327
/**
1328
 ** Do not change the format of the line below without also updating the
1329
 ** MaRTE Makefile.
1330
 **/
1331
C("Thread_Blocking_IO", Boolean, "True", "")
1332
/*
1333
   --  Set False for contexts where socket i/o are process blocking
1334
 
1335
*/
1336
 
1337
#ifdef HAVE_INET_PTON
1338
# define Inet_Pton_Linkname "inet_pton"
1339
#else
1340
# define Inet_Pton_Linkname "__gnat_inet_pton"
1341
#endif
1342
CST(Inet_Pton_Linkname, "")
1343
 
1344
#endif /* HAVE_SOCKETS */
1345
 
1346
/*
1347
 
1348
   ---------------------
1349
   -- Threads support --
1350
   ---------------------
1351
 
1352
   --  Clock identifier definitions
1353
 
1354
*/
1355
 
1356
/* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
1357
 
1358
#if defined(CLOCK_REALTIME) || defined (__hpux__)
1359
# define HAVE_CLOCK_REALTIME
1360
#endif
1361
 
1362
#ifdef HAVE_CLOCK_REALTIME
1363
CND(CLOCK_REALTIME, "System realtime clock")
1364
#endif
1365
 
1366
#ifdef CLOCK_MONOTONIC
1367
CND(CLOCK_MONOTONIC, "System monotonic clock")
1368
#endif
1369
 
1370
#ifdef CLOCK_FASTEST
1371
CND(CLOCK_FASTEST, "Fastest clock")
1372
#endif
1373
 
1374
#if defined (__sgi)
1375
CND(CLOCK_SGI_FAST,  "SGI fast clock")
1376
CND(CLOCK_SGI_CYCLE, "SGI CPU clock")
1377
#endif
1378
 
1379
#ifndef CLOCK_THREAD_CPUTIME_ID
1380
# define CLOCK_THREAD_CPUTIME_ID -1
1381
#endif
1382
CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
1383
 
1384
#if defined(__APPLE__)
1385
/* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
1386
# define CLOCK_RT_Ada "-1"
1387
 
1388
#elif defined(FreeBSD) || defined(_AIX)
1389
/** On these platforms use system provided monotonic clock instead of
1390
 ** the default CLOCK_REALTIME. We then need to set up cond var attributes
1391
 ** appropriately (see thread.c).
1392
 **/
1393
# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
1394
# define NEED_PTHREAD_CONDATTR_SETCLOCK
1395
 
1396
#elif defined(HAVE_CLOCK_REALTIME)
1397
/* By default use CLOCK_REALTIME */
1398
# define CLOCK_RT_Ada "CLOCK_REALTIME"
1399
#endif
1400
 
1401
#ifdef CLOCK_RT_Ada
1402
CNS(CLOCK_RT_Ada, "")
1403
#endif
1404
 
1405
#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
1406
/*
1407
 
1408
   --  Sizes of pthread data types
1409
 
1410
*/
1411
 
1412
#if defined (__APPLE__) || defined (DUMMY)
1413
/*
1414
   --  (on Darwin, these are just placeholders)
1415
 
1416
*/
1417
#define PTHREAD_SIZE            __PTHREAD_SIZE__
1418
#define PTHREAD_ATTR_SIZE       __PTHREAD_ATTR_SIZE__
1419
#define PTHREAD_MUTEXATTR_SIZE  __PTHREAD_MUTEXATTR_SIZE__
1420
#define PTHREAD_MUTEX_SIZE      __PTHREAD_MUTEX_SIZE__
1421
#define PTHREAD_CONDATTR_SIZE   __PTHREAD_CONDATTR_SIZE__
1422
#define PTHREAD_COND_SIZE       __PTHREAD_COND_SIZE__
1423
#define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
1424
#define PTHREAD_RWLOCK_SIZE     __PTHREAD_RWLOCK_SIZE__
1425
#define PTHREAD_ONCE_SIZE       __PTHREAD_ONCE_SIZE__
1426
#else
1427
#define PTHREAD_SIZE            (sizeof (pthread_t))
1428
#define PTHREAD_ATTR_SIZE       (sizeof (pthread_attr_t))
1429
#define PTHREAD_MUTEXATTR_SIZE  (sizeof (pthread_mutexattr_t))
1430
#define PTHREAD_MUTEX_SIZE      (sizeof (pthread_mutex_t))
1431
#define PTHREAD_CONDATTR_SIZE   (sizeof (pthread_condattr_t))
1432
#define PTHREAD_COND_SIZE       (sizeof (pthread_cond_t))
1433
#define PTHREAD_RWLOCKATTR_SIZE (sizeof (pthread_rwlockattr_t))
1434
#define PTHREAD_RWLOCK_SIZE     (sizeof (pthread_rwlock_t))
1435
#define PTHREAD_ONCE_SIZE       (sizeof (pthread_once_t))
1436
#endif
1437
 
1438
CND(PTHREAD_SIZE,            "pthread_t")
1439
CND(PTHREAD_ATTR_SIZE,       "pthread_attr_t")
1440
CND(PTHREAD_MUTEXATTR_SIZE,  "pthread_mutexattr_t")
1441
CND(PTHREAD_MUTEX_SIZE,      "pthread_mutex_t")
1442
CND(PTHREAD_CONDATTR_SIZE,   "pthread_condattr_t")
1443
CND(PTHREAD_COND_SIZE,       "pthread_cond_t")
1444
CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
1445
CND(PTHREAD_RWLOCK_SIZE,     "pthread_rwlock_t")
1446
CND(PTHREAD_ONCE_SIZE,       "pthread_once_t")
1447
 
1448
#endif /* __APPLE__ || __linux__ */
1449
 
1450
/**
1451
 **  System-specific constants follow
1452
 **  Each section should be activated if compiling for the corresponding
1453
 **  platform *or* generating the dummy version for runtime test compilation.
1454
 **/
1455
 
1456
#if defined (__vxworks) || defined (DUMMY)
1457
 
1458
/*
1459
 
1460
   --------------------------------
1461
   -- VxWorks-specific constants --
1462
   --------------------------------
1463
 
1464
   --  These constants may be used only within the VxWorks version of
1465
   --  GNAT.Sockets.Thin.
1466
*/
1467
 
1468
CND(OK,    "VxWorks generic success")
1469
CND(ERROR, "VxWorks generic error")
1470
 
1471
#endif /* __vxworks */
1472
 
1473
#if defined (__MINGW32__) || defined (DUMMY)
1474
/*
1475
 
1476
   ------------------------------
1477
   -- MinGW-specific constants --
1478
   ------------------------------
1479
 
1480
   --  These constants may be used only within the MinGW version of
1481
   --  GNAT.Sockets.Thin.
1482
*/
1483
 
1484
CND(WSASYSNOTREADY,     "System not ready")
1485
CND(WSAVERNOTSUPPORTED, "Version not supported")
1486
CND(WSANOTINITIALISED,  "Winsock not initialized")
1487
CND(WSAEDISCON,         "Disconnected")
1488
 
1489
#endif /* __MINGW32__ */
1490
 
1491
/**
1492
 ** End of constants definitions
1493
 **/
1494
 
1495
#ifdef NATIVE
1496
   putchar ('\n');
1497
#endif
1498
 
1499
/*
1500
 
1501
end System.OS_Constants;
1502
*/
1503
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.