* jump.c: Remove prototypes for delete_computation and
[official-gcc.git] / gcc / ada / gen-soccon.c
blobe8284335bcf2519d7120f9559c13c7c85523299b
1 /****************************************************************************
2 * *
3 * GNAT SYSTEM UTILITIES *
4 * *
5 * G E N - S O C C O N *
6 * *
7 * Copyright (C) 2004-2005, Free Software Foundation, Inc. *
8 * *
9 * GNAT is free software; you can redistribute it and/or modify it under *
10 * terms of the GNU General Public License as published by the Free Soft- *
11 * ware Foundation; either version 2, or (at your option) any later ver- *
12 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
13 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
15 * for more details. You should have received a copy of the GNU General *
16 * Public License distributed with GNAT; see file COPYING. If not, write *
17 * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
18 * Boston, MA 02110-1301, USA. *
19 * *
20 * GNAT was originally developed by the GNAT team at New York University. *
21 * Extensive contributions were provided by Ada Core Technologies Inc. *
22 * *
23 ****************************************************************************/
25 /* This program generates g-soccon.ads */
27 /* To build using DEC C:
28 CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
29 LINK gen-soccon
30 RUN gen-soccon
33 #ifndef TARGET
34 # error Please define TARGET
35 #endif
37 #include <stdlib.h>
38 #include <stdio.h>
39 #include <string.h>
40 #include <limits.h>
42 #ifdef __MINGW32__
43 #include <fcntl.h>
44 #endif
46 #include "gsocket.h"
48 struct line {
49 char *text;
50 char *value;
51 char *comment;
52 struct line *next;
55 struct line *first = NULL, *last = NULL;
57 #define TXT(_text) add_line(_text, NULL, NULL);
58 /* Plain text */
60 #define _NL TXT("")
61 /* Empty line */
63 #define itoad(n) f_itoa ("%d", (n))
64 #define itoax(n) f_itoa ("16#%08x#", (n))
66 #define CND(name,comment) add_line(#name, itoad (name), comment);
67 /* Constant (decimal) */
69 #define CNX(name,comment) add_line(#name, itoax (name), comment);
70 /* Constant (hexadecimal) */
72 #define CN_(name,comment) add_line(#name, name, comment);
73 /* Constant (generic) */
75 #define STR(p) STR1(p)
76 #define STR1(p) #p
78 void output (void);
79 /* Generate output spec */
81 char *f_itoa (char *, int);
82 /* int to string */
84 void add_line (char *, char*, char*);
86 #ifdef __MINGW32__
87 unsigned int _CRT_fmode = _O_BINARY;
88 #endif
90 int
91 main (void) {
93 TXT("------------------------------------------------------------------------------")
94 TXT("-- --")
95 TXT("-- GNAT COMPILER COMPONENTS --")
96 TXT("-- --")
97 TXT("-- G N A T . S O C K E T S . C O N S T A N T S --")
98 TXT("-- --")
99 TXT("-- S p e c --")
100 TXT("-- --")
101 TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --")
102 TXT("-- --")
103 TXT("-- GNAT is free software; you can redistribute it and/or modify it under --")
104 TXT("-- terms of the GNU General Public License as published by the Free Soft- --")
105 TXT("-- ware Foundation; either version 2, or (at your option) any later ver- --")
106 TXT("-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --")
107 TXT("-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --")
108 TXT("-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --")
109 TXT("-- for more details. You should have received a copy of the GNU General --")
110 TXT("-- Public License distributed with GNAT; see file COPYING. If not, write --")
111 TXT("-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --")
112 TXT("-- Boston, MA 02110-1301, USA. --")
113 TXT("-- --")
114 TXT("-- As a special exception, if other files instantiate generics from this --")
115 TXT("-- unit, or you link this unit with other files to produce an executable, --")
116 TXT("-- this unit does not by itself cause the resulting executable to be --")
117 TXT("-- covered by the GNU General Public License. This exception does not --")
118 TXT("-- however invalidate any other reasons why the executable file might be --")
119 TXT("-- covered by the GNU Public License. --")
120 TXT("-- --")
121 TXT("-- GNAT was originally developed by the GNAT team at New York University. --")
122 TXT("-- Extensive contributions were provided by Ada Core Technologies Inc. --")
123 TXT("-- --")
124 TXT("------------------------------------------------------------------------------")
126 TXT("-- This package provides target dependent definitions of constant for use")
127 TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
128 TXT("-- directly with'ed by an applications program.")
130 TXT("-- This is the version for " TARGET)
131 TXT("-- This file is generated automatically, do not modify it by hand! Instead,")
132 TXT("-- make changes to gen-soccon.c and re-run it on each target.")
134 TXT("package GNAT.Sockets.Constants is")
136 TXT(" --------------")
137 TXT(" -- Families --")
138 TXT(" --------------")
141 #ifndef AF_INET
142 #define AF_INET -1
143 #endif
144 CND(AF_INET, "IPv4 address family")
146 #ifndef AF_INET6
147 #define AF_INET6 -1
148 #endif
149 CND(AF_INET6, "IPv6 address family")
151 TXT(" -----------")
152 TXT(" -- Modes --")
153 TXT(" -----------")
156 #ifndef SOCK_STREAM
157 #define SOCK_STREAM -1
158 #endif
159 CND(SOCK_STREAM, "Stream socket")
161 #ifndef SOCK_DGRAM
162 #define SOCK_DGRAM -1
163 #endif
164 CND(SOCK_DGRAM, "Datagram socket")
166 TXT(" -------------------")
167 TXT(" -- Socket errors --")
168 TXT(" -------------------")
171 #ifndef EACCES
172 #define EACCES -1
173 #endif
174 CND(EACCES, "Permission denied")
176 #ifndef EADDRINUSE
177 #define EADDRINUSE -1
178 #endif
179 CND(EADDRINUSE, "Address already in use")
181 #ifndef EADDRNOTAVAIL
182 #define EADDRNOTAVAIL -1
183 #endif
184 CND(EADDRNOTAVAIL, "Cannot assign address")
186 #ifndef EAFNOSUPPORT
187 #define EAFNOSUPPORT -1
188 #endif
189 CND(EAFNOSUPPORT, "Addr family not supported")
191 #ifndef EALREADY
192 #define EALREADY -1
193 #endif
194 CND(EALREADY, "Operation in progress")
196 #ifndef EBADF
197 #define EBADF -1
198 #endif
199 CND(EBADF, "Bad file descriptor")
201 #ifndef ECONNABORTED
202 #define ECONNABORTED -1
203 #endif
204 CND(ECONNABORTED, "Connection aborted")
206 #ifndef ECONNREFUSED
207 #define ECONNREFUSED -1
208 #endif
209 CND(ECONNREFUSED, "Connection refused")
211 #ifndef ECONNRESET
212 #define ECONNRESET -1
213 #endif
214 CND(ECONNRESET, "Connection reset by peer")
216 #ifndef EDESTADDRREQ
217 #define EDESTADDRREQ -1
218 #endif
219 CND(EDESTADDRREQ, "Destination addr required")
221 #ifndef EFAULT
222 #define EFAULT -1
223 #endif
224 CND(EFAULT, "Bad address")
226 #ifndef EHOSTDOWN
227 #define EHOSTDOWN -1
228 #endif
229 CND(EHOSTDOWN, "Host is down")
231 #ifndef EHOSTUNREACH
232 #define EHOSTUNREACH -1
233 #endif
234 CND(EHOSTUNREACH, "No route to host")
236 #ifndef EINPROGRESS
237 #define EINPROGRESS -1
238 #endif
239 CND(EINPROGRESS, "Operation now in progress")
241 #ifndef EINTR
242 #define EINTR -1
243 #endif
244 CND(EINTR, "Interrupted system call")
246 #ifndef EINVAL
247 #define EINVAL -1
248 #endif
249 CND(EINVAL, "Invalid argument")
251 #ifndef EIO
252 #define EIO -1
253 #endif
254 CND(EIO, "Input output error")
256 #ifndef EISCONN
257 #define EISCONN -1
258 #endif
259 CND(EISCONN, "Socket already connected")
261 #ifndef ELOOP
262 #define ELOOP -1
263 #endif
264 CND(ELOOP, "Too many symbolic lynks")
266 #ifndef EMFILE
267 #define EMFILE -1
268 #endif
269 CND(EMFILE, "Too many open files")
271 #ifndef EMSGSIZE
272 #define EMSGSIZE -1
273 #endif
274 CND(EMSGSIZE, "Message too long")
276 #ifndef ENAMETOOLONG
277 #define ENAMETOOLONG -1
278 #endif
279 CND(ENAMETOOLONG, "Name too long")
281 #ifndef ENETDOWN
282 #define ENETDOWN -1
283 #endif
284 CND(ENETDOWN, "Network is down")
286 #ifndef ENETRESET
287 #define ENETRESET -1
288 #endif
289 CND(ENETRESET, "Disconn. on network reset")
291 #ifndef ENETUNREACH
292 #define ENETUNREACH -1
293 #endif
294 CND(ENETUNREACH, "Network is unreachable")
296 #ifndef ENOBUFS
297 #define ENOBUFS -1
298 #endif
299 CND(ENOBUFS, "No buffer space available")
301 #ifndef ENOPROTOOPT
302 #define ENOPROTOOPT -1
303 #endif
304 CND(ENOPROTOOPT, "Protocol not available")
306 #ifndef ENOTCONN
307 #define ENOTCONN -1
308 #endif
309 CND(ENOTCONN, "Socket not connected")
311 #ifndef ENOTSOCK
312 #define ENOTSOCK -1
313 #endif
314 CND(ENOTSOCK, "Operation on non socket")
316 #ifndef EOPNOTSUPP
317 #define EOPNOTSUPP -1
318 #endif
319 CND(EOPNOTSUPP, "Operation not supported")
321 #ifndef EPFNOSUPPORT
322 #define EPFNOSUPPORT -1
323 #endif
324 CND(EPFNOSUPPORT, "Unknown protocol family")
326 #ifndef EPROTONOSUPPORT
327 #define EPROTONOSUPPORT -1
328 #endif
329 CND(EPROTONOSUPPORT, "Unknown protocol")
331 #ifndef EPROTOTYPE
332 #define EPROTOTYPE -1
333 #endif
334 CND(EPROTOTYPE, "Unknown protocol type")
336 #ifndef ESHUTDOWN
337 #define ESHUTDOWN -1
338 #endif
339 CND(ESHUTDOWN, "Cannot send once shutdown")
341 #ifndef ESOCKTNOSUPPORT
342 #define ESOCKTNOSUPPORT -1
343 #endif
344 CND(ESOCKTNOSUPPORT, "Socket type not supported")
346 #ifndef ETIMEDOUT
347 #define ETIMEDOUT -1
348 #endif
349 CND(ETIMEDOUT, "Connection timed out")
351 #ifndef ETOOMANYREFS
352 #define ETOOMANYREFS -1
353 #endif
354 CND(ETOOMANYREFS, "Too many references")
356 #ifndef EWOULDBLOCK
357 #define EWOULDBLOCK -1
358 #endif
359 CND(EWOULDBLOCK, "Operation would block")
361 TXT(" -----------------")
362 TXT(" -- Host errors --")
363 TXT(" -----------------")
366 #ifndef HOST_NOT_FOUND
367 #define HOST_NOT_FOUND -1
368 #endif
369 CND(HOST_NOT_FOUND, "Unknown host")
371 #ifndef TRY_AGAIN
372 #define TRY_AGAIN -1
373 #endif
374 CND(TRY_AGAIN, "Host name lookup failure")
376 #ifndef NO_DATA
377 #define NO_DATA -1
378 #endif
379 CND(NO_DATA, "No data record for name")
381 #ifndef NO_RECOVERY
382 #define NO_RECOVERY -1
383 #endif
384 CND(NO_RECOVERY, "Non recoverable errors")
386 TXT(" -------------------")
387 TXT(" -- Control flags --")
388 TXT(" -------------------")
391 #ifndef FIONBIO
392 #define FIONBIO -1
393 #endif
394 CND(FIONBIO, "Set/clear non-blocking io")
396 #ifndef FIONREAD
397 #define FIONREAD -1
398 #endif
399 CND(FIONREAD, "How many bytes to read")
401 TXT(" --------------------")
402 TXT(" -- Shutdown modes --")
403 TXT(" --------------------")
406 #ifndef SHUT_RD
407 #define SHUT_RD -1
408 #endif
409 CND(SHUT_RD, "No more recv")
411 #ifndef SHUT_WR
412 #define SHUT_WR -1
413 #endif
414 CND(SHUT_WR, "No more send")
416 #ifndef SHUT_RDWR
417 #define SHUT_RDWR -1
418 #endif
419 CND(SHUT_RDWR, "No more recv/send")
421 TXT(" ---------------------")
422 TXT(" -- Protocol levels --")
423 TXT(" ---------------------")
426 #ifndef SOL_SOCKET
427 #define SOL_SOCKET -1
428 #endif
429 CND(SOL_SOCKET, "Options for socket level")
431 #ifndef IPPROTO_IP
432 #define IPPROTO_IP -1
433 #endif
434 CND(IPPROTO_IP, "Dummy protocol for IP")
436 #ifndef IPPROTO_UDP
437 #define IPPROTO_UDP -1
438 #endif
439 CND(IPPROTO_UDP, "UDP")
441 #ifndef IPPROTO_TCP
442 #define IPPROTO_TCP -1
443 #endif
444 CND(IPPROTO_TCP, "TCP")
446 TXT(" -------------------")
447 TXT(" -- Request flags --")
448 TXT(" -------------------")
451 #ifndef MSG_OOB
452 #define MSG_OOB -1
453 #endif
454 CND(MSG_OOB, "Process out-of-band data")
456 #ifndef MSG_PEEK
457 #define MSG_PEEK -1
458 #endif
459 CND(MSG_PEEK, "Peek at incoming data")
461 #ifndef MSG_EOR
462 #define MSG_EOR -1
463 #endif
464 CND(MSG_EOR, "Send end of record")
466 #ifndef MSG_WAITALL
467 #define MSG_WAITALL -1
468 #endif
469 CND(MSG_WAITALL, "Wait for full reception")
471 #ifndef MSG_NOSIGNAL
472 #define MSG_NOSIGNAL -1
473 #endif
474 CND(MSG_NOSIGNAL, "No SIGPIPE on send")
476 #ifdef __linux__
477 # define MSG_Forced_Flags "MSG_NOSIGNAL"
478 #else
479 # define MSG_Forced_Flags "0"
480 #endif
481 CN_(MSG_Forced_Flags, "")
482 TXT(" -- Flags set on all send(2) calls")
485 TXT(" --------------------")
486 TXT(" -- Socket options --")
487 TXT(" --------------------")
490 #ifndef TCP_NODELAY
491 #define TCP_NODELAY -1
492 #endif
493 CND(TCP_NODELAY, "Do not coalesce packets")
495 #ifndef SO_REUSEADDR
496 #define SO_REUSEADDR -1
497 #endif
498 CND(SO_REUSEADDR, "Bind reuse local address")
500 #ifndef SO_KEEPALIVE
501 #define SO_KEEPALIVE -1
502 #endif
503 CND(SO_KEEPALIVE, "Enable keep-alive msgs")
505 #ifndef SO_LINGER
506 #define SO_LINGER -1
507 #endif
508 CND(SO_LINGER, "Defer close to flush data")
510 #ifndef SO_BROADCAST
511 #define SO_BROADCAST -1
512 #endif
513 CND(SO_BROADCAST, "Can send broadcast msgs")
515 #ifndef SO_SNDBUF
516 #define SO_SNDBUF -1
517 #endif
518 CND(SO_SNDBUF, "Set/get send buffer size")
520 #ifndef SO_RCVBUF
521 #define SO_RCVBUF -1
522 #endif
523 CND(SO_RCVBUF, "Set/get recv buffer size")
525 #ifndef SO_SNDTIMEO
526 #define SO_SNDTIMEO -1
527 #endif
528 CND(SO_SNDTIMEO, "Emission timeout")
530 #ifndef SO_RCVTIMEO
531 #define SO_RCVTIMEO -1
532 #endif
533 CND(SO_RCVTIMEO, "Reception timeout")
535 #ifndef SO_ERROR
536 #define SO_ERROR -1
537 #endif
538 CND(SO_ERROR, "Get/clear error status")
540 #ifndef IP_MULTICAST_IF
541 #define IP_MULTICAST_IF -1
542 #endif
543 CND(IP_MULTICAST_IF, "Set/get mcast interface")
545 #ifndef IP_MULTICAST_TTL
546 #define IP_MULTICAST_TTL -1
547 #endif
548 CND(IP_MULTICAST_TTL, "Set/get multicast TTL")
550 #ifndef IP_MULTICAST_LOOP
551 #define IP_MULTICAST_LOOP -1
552 #endif
553 CND(IP_MULTICAST_LOOP, "Set/get mcast loopback")
555 #ifndef IP_ADD_MEMBERSHIP
556 #define IP_ADD_MEMBERSHIP -1
557 #endif
558 CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
560 #ifndef IP_DROP_MEMBERSHIP
561 #define IP_DROP_MEMBERSHIP -1
562 #endif
563 CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
566 TXT(" -------------------")
567 TXT(" -- System limits --")
568 TXT(" -------------------")
571 #ifndef IOV_MAX
572 #define IOV_MAX INT_MAX
573 #endif
574 CND(IOV_MAX, "Maximum writev iovcnt")
577 TXT(" ----------------------")
578 TXT(" -- Type definitions --")
579 TXT(" ----------------------")
583 struct timeval tv;
584 TXT(" -- Sizes (in bytes) of the components of struct timeval")
586 #define SIZEOF_tv_sec (sizeof tv.tv_sec)
587 CND(SIZEOF_tv_sec, "tv_sec")
588 #define SIZEOF_tv_usec (sizeof tv.tv_usec)
589 CND(SIZEOF_tv_usec, "tv_usec")
592 #ifdef __vxworks
594 TXT(" --------------------------------")
595 TXT(" -- VxWorks-specific constants --")
596 TXT(" --------------------------------")
598 TXT(" -- These constants may be used only within the VxWorks version of")
599 TXT(" -- GNAT.Sockets.Thin.")
602 CND(OK, "VxWorks generic success")
603 CND(ERROR, "VxWorks generic error")
604 #endif
607 TXT("end GNAT.Sockets.Constants;")
609 output ();
610 return 0;
613 void
614 output (void) {
615 int text_max = 0, value_max = 0, l;
616 struct line *p;
617 char fmt[64];
618 #define UPD_MAX(x) do { \
619 l = strlen (p->x); \
620 if (l > x ## _max) x ## _max = l; \
621 } while (0)
623 for (p = first; p != NULL; p = p->next) {
624 if (p->value != NULL) {
625 UPD_MAX(text);
626 UPD_MAX(value);
629 sprintf (fmt, " %%-%ds : constant := %%%ds;%%s%%s\n",
630 text_max, value_max);
632 for (p = first; p != NULL; p = p->next) {
633 if (p->value == NULL) {
634 printf ("%s\n", p->text);
635 } else {
636 char *comment_sep = (strlen (p->comment) > 0)
637 ? " -- " : "";
638 printf (fmt, p->text, p->value, comment_sep, p->comment);
643 char *
644 f_itoa (char *fmt, int n) {
645 char buf[32], *ret;
646 sprintf (buf, fmt, n);
647 ret = malloc (strlen (buf) + 1);
648 if (ret != NULL)
649 strcpy (ret, buf);
650 return ret;
653 void
654 add_line (char *_text, char *_value, char *_comment) {
655 struct line *l = (struct line *) malloc (sizeof (struct line));
657 l->text = _text;
658 l->value = _value;
659 l->comment = _comment;
660 l->next = NULL;
661 if (last == NULL)
662 first = last = l;
663 else {
664 last->next = l;
665 last = l;