Commit 4f100fd7 by Andris Pavenis Committed by Andris Pavenis

ctrl_c.c: Do not use macro SA_RESTART for DJGPP.

2016-10-11  Andris Pavenis  <andris.pavenis@iki.fi>

	* ctrl_c.c: Do not use macro SA_RESTART for DJGPP.
	* gsocket.h: Do not support sockets for DJGPP.
	* init.c (__gnat_install_handler): Implememt for DJGPP
	* sysdep.c: Include <io.h> for DJGPP
	(_setmode): Define to setmode for DJGPP
	(__gnat_set_mode): Add implementation for DJGPP
	(__gnat_localtime_tzoff): Use localtime_r for DJGPP
	* terminals.c: Add DJGPP to list of unsupported platforms.
	* env.c (__gnat_clearenv): use _gnat_unsetenv on all entries for DJGPP

From-SVN: r240997
parent a32fc216
2016-10-11 Andris Pavenis <andris.pavenis@iki.fi>
* ctrl_c.c: Do not use macro SA_RESTART for DJGPP.
* gsocket.h: Do not support sockets for DJGPP.
* init.c (__gnat_install_handler): Implememt for DJGPP
* sysdep.c: Include <io.h> for DJGPP
(_setmode): Define to setmode for DJGPP
(__gnat_set_mode): Add implementation for DJGPP
(__gnat_localtime_tzoff): Use localtime_r for DJGPP
* terminals.c: Add DJGPP to list of unsupported platforms.
* env.c (__gnat_clearenv): use _gnat_unsetenv on all entries for DJGPP
2016-10-11 Pierre-Marie de Rodat <derodat@adacore.com> 2016-10-11 Pierre-Marie de Rodat <derodat@adacore.com>
* exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types. * exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types.
......
...@@ -92,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void)) ...@@ -92,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void))
if (sigint_intercepted == 0) if (sigint_intercepted == 0)
{ {
act.sa_handler = __gnat_int_handler; act.sa_handler = __gnat_int_handler;
#if defined (__Lynx__) || defined (VMS) #if defined (__Lynx__) || defined (VMS) || defined(__DJGPP__)
/* LynxOS and VMS do not support SA_RESTART. */ /* LynxOS, VMS and DJGPP do not support SA_RESTART. */
act.sa_flags = 0; act.sa_flags = 0;
#else #else
act.sa_flags = SA_RESTART; act.sa_flags = SA_RESTART;
......
...@@ -302,7 +302,7 @@ void __gnat_clearenv (void) ...@@ -302,7 +302,7 @@ void __gnat_clearenv (void)
#elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \ #elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \
|| (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \ || (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \
|| defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__) \ || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__) \
|| defined (__DragonFly__) || defined (__DragonFly__) || defined (__DJGPP__)
/* On Windows, FreeBSD and MacOS there is no function to clean all the /* On Windows, FreeBSD and MacOS there is no function to clean all the
environment but there is a "clean" way to unset a variable. So go environment but there is a "clean" way to unset a variable. So go
through the environ table and call __gnat_unsetenv on all entries */ through the environ table and call __gnat_unsetenv on all entries */
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#if defined(VTHREADS) || defined(__PikeOS__) #if defined(VTHREADS) || defined(__PikeOS__) || defined(__DJGPP__)
/* Sockets not supported on these platforms. */ /* Sockets not supported on these platforms. */
#undef HAVE_SOCKETS #undef HAVE_SOCKETS
......
...@@ -2516,6 +2516,14 @@ __gnat_install_handler (void) ...@@ -2516,6 +2516,14 @@ __gnat_install_handler (void)
__gnat_handler_installed = 1; __gnat_handler_installed = 1;
} }
#elif defined (__DJGPP__)
void
__gnat_install_handler ()
{
__gnat_handler_installed = 1;
}
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
/*******************/ /*******************/
......
...@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *); ...@@ -126,7 +126,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
*/ */
#if defined (WINNT) || defined (__CYGWIN__) #if defined (WINNT) || defined (__CYGWIN__) || defined(__DJGPP__)
const char __gnat_text_translation_required = 1; const char __gnat_text_translation_required = 1;
...@@ -137,6 +137,11 @@ const char __gnat_text_translation_required = 1; ...@@ -137,6 +137,11 @@ const char __gnat_text_translation_required = 1;
#define WIN_SETMODE _setmode #define WIN_SETMODE _setmode
#endif #endif
#if defined(__DJGPP__)
#include <io.h>
#define _setmode setmode
#endif /* __DJGPP__ */
void void
__gnat_set_binary_mode (int handle) __gnat_set_binary_mode (int handle)
{ {
...@@ -149,6 +154,30 @@ __gnat_set_text_mode (int handle) ...@@ -149,6 +154,30 @@ __gnat_set_text_mode (int handle)
WIN_SETMODE (handle, O_TEXT); WIN_SETMODE (handle, O_TEXT);
} }
#ifdef __DJGPP__
void
__gnat_set_mode (int handle, int mode)
{
/* the values here must be synchronized with
System.File_Control_Block.Content_Encodding:
None = 0
Default_Text = 1
Text = 2
U8text = 3
Wtext = 4
U16text = 5 */
switch (mode) {
case 0 : setmode(handle, O_BINARY); break;
case 1 : setmode(handle, O_TEXT); break;
case 2 : setmode(handle, O_TEXT); break;
case 3 : setmode(handle, O_TEXT); break;
case 4 : setmode(handle, O_BINARY); break;
case 5 : setmode(handle, O_BINARY); break;
}
}
#else
void void
__gnat_set_mode (int handle, int mode) __gnat_set_mode (int handle, int mode)
{ {
...@@ -171,6 +200,7 @@ __gnat_set_mode (int handle, int mode) ...@@ -171,6 +200,7 @@ __gnat_set_mode (int handle, int mode)
case 5 : WIN_SETMODE (handle, _O_U16TEXT); break; case 5 : WIN_SETMODE (handle, _O_U16TEXT); break;
} }
} }
#endif
#ifdef __CYGWIN__ #ifdef __CYGWIN__
...@@ -795,7 +825,8 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED, ...@@ -795,7 +825,8 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
struct tm */ struct tm */
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
|| defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
|| defined(__DJGPP__)
{ {
localtime_r (timer, &tp); localtime_r (timer, &tp);
*off = tp.tm_gmtoff; *off = tp.tm_gmtoff;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
/* First all usupported platforms. Add stubs for exported routines. */ /* First all usupported platforms. Add stubs for exported routines. */
#if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \ #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
|| defined (__ANDROID__) || defined (__PikeOS__) || defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
#define ATTRIBUTE_UNUSED __attribute__((unused)) #define ATTRIBUTE_UNUSED __attribute__((unused))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment