diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 13:50:37 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 13:50:37 +0000 |
commit | 02747205c562d60e12b1c96b8cd6d3ee6eedea3a (patch) | |
tree | d1576a6497bfbada92fc3b0b451f8c360df4d37d /gcc/ada/gen-soccon.c | |
parent | aa976da570b177e1a38dddbb3bf035c240bb415f (diff) | |
download | gcc-02747205c562d60e12b1c96b8cd6d3ee6eedea3a.tar.gz |
2005-11-14 Thomas Quinot <quinot@adacore.com>
* g-soccon.ads: Minor reformatting. Update comments.
* gsocket.h: Include <sys/times.h> in the VxWorks case, in order to
gain visibility on the declaration of struct timeval.
* g-soccon-freebsd.ads,
g-soccon-darwin.ads,
g-soccon-tru64.ads,
g-soccon-aix.ads,
g-soccon-irix.ads,
g-soccon-hpux.ads,
g-soccon-solaris.ads,
g-soccon-vms.ads,
g-soccon-mingw.ads,
g-soccon-vxworks.ads (SIZEOF_tv_sec, SIZEOF_tv_usec): New constants.
* g-soccon-hpux-ia64.ads, g-soccon-linux-ppc.ads,
g-soccon-solaris-64.ads, g-soccon-linux-64.ads,
g-soccon-linux-x86.ads: New files.
* g-socthi-mingw.adb:
(Socket_Error_Message): Remove redundant use of GNAT.Sockets.Constants
* g-socthi-vxworks.ads, g-socthi-vms.ads, g-socthi-mingw.ads
(time_t, suseconds_t): New types constructed to match the tv_sec
and tv_usec fields of C struct timeval.
(Timeval): Construct structure in terms of the new types.
(Host_Errno): New function (imported from socket.c), returns last hosts
database error.
* g-socthi-vxworks.adb: Add error handling circuitry.
* g-socket.ads, g-socket.adb (To_Timeval): Reflect change of type for
components of struct timeval.
(Get_Host_By_Name, Get_Host_By_Address): Fix error reporting circuitry.
(Check_Selector): In error conditions, clear internal socket sets to
avoid a memory leak.
(Get_Socket_Option, Set_Socket_Option): Support for Multicast_If,
Send_Timeout, Receive_Timeout.
* g-socthi.ads (time_t, suseconds_t): New types constructed to match
the tv_sec and tv_usec fields of C struct timeval.
(Timeval): Construct structure in terms of the new types.
(Host_Errno): New function (imported from socket.c), returns last hosts
database error.
* socket.c (__gnat_get_h_errno): New function to retrieve h_errno, the
hosts database last error code.
* gen-soccon.c: Complete value expansion should not be performed on
TARGET, as it has the form of a math expression, and some components
may be platform-defined macros.
For VxWorks, generate the OK and ERROR values.
New constants giving the sizes of the components of C struct timeval.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106949 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gen-soccon.c')
-rw-r--r-- | gcc/ada/gen-soccon.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c index 363416a674f..e8284335bcf 100644 --- a/gcc/ada/gen-soccon.c +++ b/gcc/ada/gen-soccon.c @@ -4,7 +4,7 @@ * * * G E N - S O C C O N * * * - * Copyright (C) 2004-2005 Free Software Foundation, Inc. * + * Copyright (C) 2004-2005, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -25,7 +25,7 @@ /* This program generates g-soccon.ads */ /* To build using DEC C: - CC/DEFINE="TARGET=OpenVMS" gen-soccon + CC/DEFINE="TARGET=""OpenVMS""" gen-soccon LINK gen-soccon RUN gen-soccon */ @@ -37,6 +37,11 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <limits.h> + +#ifdef __MINGW32__ +#include <fcntl.h> +#endif #include "gsocket.h" @@ -55,8 +60,8 @@ struct line *first = NULL, *last = NULL; #define _NL TXT("") /* Empty line */ -#define itoad(n) f_itoa ("%d", n) -#define itoax(n) f_itoa ("16#%08x#", n) +#define itoad(n) f_itoa ("%d", (n)) +#define itoax(n) f_itoa ("16#%08x#", (n)) #define CND(name,comment) add_line(#name, itoad (name), comment); /* Constant (decimal) */ @@ -78,6 +83,10 @@ char *f_itoa (char *, int); void add_line (char *, char*, char*); +#ifdef __MINGW32__ +unsigned int _CRT_fmode = _O_BINARY; +#endif + int main (void) { @@ -89,7 +98,7 @@ TXT("-- G N A T . S O C K E T S . C O N S T A N T S TXT("-- --") TXT("-- S p e c --") TXT("-- --") -TXT("-- Copyright (C) 2000-2005 Free Software Foundation, Inc. --") +TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --") TXT("-- --") TXT("-- GNAT is free software; you can redistribute it and/or modify it under --") TXT("-- terms of the GNU General Public License as published by the Free Soft- --") @@ -118,7 +127,7 @@ TXT("-- This package provides target dependent definitions of constant for use" TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be") TXT("-- directly with'ed by an applications program.") _NL -TXT("-- This is the version for " STR (TARGET)) +TXT("-- This is the version for " TARGET) TXT("-- This file is generated automatically, do not modify it by hand! Instead,") TXT("-- make changes to gen-soccon.c and re-run it on each target.") _NL @@ -565,6 +574,36 @@ _NL CND(IOV_MAX, "Maximum writev iovcnt") _NL +TXT(" ----------------------") +TXT(" -- Type definitions --") +TXT(" ----------------------") +_NL + +{ + struct timeval tv; +TXT(" -- Sizes (in bytes) of the components of struct timeval") +_NL +#define SIZEOF_tv_sec (sizeof tv.tv_sec) +CND(SIZEOF_tv_sec, "tv_sec") +#define SIZEOF_tv_usec (sizeof tv.tv_usec) +CND(SIZEOF_tv_usec, "tv_usec") +} + +#ifdef __vxworks +_NL +TXT(" --------------------------------") +TXT(" -- VxWorks-specific constants --") +TXT(" --------------------------------") +_NL +TXT(" -- These constants may be used only within the VxWorks version of") +TXT(" -- GNAT.Sockets.Thin.") +_NL + +CND(OK, "VxWorks generic success") +CND(ERROR, "VxWorks generic error") +#endif + +_NL TXT("end GNAT.Sockets.Constants;") output (); @@ -614,6 +653,7 @@ f_itoa (char *fmt, int n) { void add_line (char *_text, char *_value, char *_comment) { struct line *l = (struct line *) malloc (sizeof (struct line)); + l->text = _text; l->value = _value; l->comment = _comment; |