** s-oscons-tmpl.s.
**
** The default one assumes that the template can be compiled by the newly-
- ** build cross compiler. It uses markup produced in the (pseudo-)assembly
+ ** built cross compiler. It uses markup produced in the (pseudo-)assembly
** listing:
**
** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
** $ DEFINE/USER SYS$OUTPUT s-oscons-tmplt.s
** $ RUN s-oscons-tmplt
** $ RUN xoscons
- **
**/
-#ifndef TARGET
-# error Please define TARGET
+#if defined (__linux__) && !defined (_XOPEN_SOURCE)
+/** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
+ **/
+#define _XOPEN_SOURCE 500
+
+#elif defined (__mips) && defined (__sgi)
+/** For IRIX _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as IOV_MAX,
+ ** otherwise IOV_MAX is not defined.
+ **/
+#define _XOPEN5
+#define IOV_MAX _XOPEN_IOV_MAX
#endif
#include <stdlib.h>
# define HAVE_TERMIOS
#endif
+#if defined (__vxworks)
+
+/**
+ ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
+ ** the case of runtime libraries that support sockets).
+ **/
+
+# include <vxWorks.h>
+#endif
+
#include "gsocket.h"
+#ifdef DUMMY
+
+# if defined (TARGET)
+# error TARGET may not be defined when generating the dummy version
+# else
+# define TARGET "batch runtime compilation (dummy values)"
+# endif
+
+# if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
+# error Features missing on platform
+# endif
+
+# define NATIVE
+
+#endif
+
+#ifndef TARGET
+# error Please define TARGET
+#endif
+
#ifndef HAVE_SOCKETS
# include <errno.h>
#endif
#ifdef NATIVE
#include <stdio.h>
+
+#ifdef DUMMY
+int counter = 0;
+# define _VAL(x) counter++
+#else
+# define _VAL(x) x
+#endif
+
#define CND(name,comment) \
- printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) name));
+ printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
#define CNS(name,comment) \
printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
#endif
+#define STR(x) STR1(x)
+#define STR1(x) #x
+
#ifdef __MINGW32__
unsigned int _CRT_fmode = _O_BINARY;
#endif
/*
+ -----------------------------
+ -- Platform identification --
+ -----------------------------
+
+*/
+TXT(" Target_Name : constant String := " STR(TARGET) ";")
+/*
+ type Target_OS_Type is (Windows, VMS, Other_OS);
+*/
+#if defined (__MINGW32__)
+# define TARGET_OS "Windows"
+#elif defined (__VMS)
+# define TARGET_OS "VMS"
+#else
+# define TARGET_OS "Other_OS"
+#endif
+TXT(" Target_OS : constant Target_OS_Type := " TARGET_OS ";")
+/*
+
-------------------
-- System limits --
-------------------
#endif
CND(EPROTOTYPE, "Unknown protocol type")
+#ifndef ERANGE
+# define ERANGE -1
+#endif
+CND(ERANGE, "Result too large")
+
#ifndef ESHUTDOWN
# define ESHUTDOWN -1
#endif
/*
+ -- Fields of struct msghdr
+*/
+
+#if defined (__sun__) || defined (__hpux__)
+# define msg_iovlen_t "int"
+#else
+# define msg_iovlen_t "size_t"
+#endif
+
+TXT(" subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
+
+/*
+
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
TXT(" Thread_Blocking_IO : constant Boolean := True;")
/*
-- Set False for contexts where socket i/o are process blocking
+
*/
+#ifdef HAVE_INET_PTON
+# define Inet_Pton_Linkname "inet_pton"
+#else
+# define Inet_Pton_Linkname "__gnat_inet_pton"
+#endif
+TXT(" Inet_Pton_Linkname : constant String := \"" Inet_Pton_Linkname "\";")
+
#endif /* HAVE_SOCKETS */
/**
** System-specific constants follow
+ ** Each section should be activated if compiling for the corresponding
+ ** platform *or* generating the dummy version for runtime test compilation.
**/
-#ifdef __vxworks
+#if defined (__vxworks) || defined (DUMMY)
/*
#endif
-#ifdef __MINGW32__
+#if defined (__MINGW32__) || defined (DUMMY)
/*
------------------------------
putchar ('\n');
#endif
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined (DUMMY)
/*
-------------------------------