This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Ada: Patch to sysdep.c for __MINGW32__
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Dec 2001 12:01:54 +1100 (EST)
- Subject: Ada: Patch to sysdep.c for __MINGW32__
Hello.
The following patch allows __MINGW32__ to build using recent (since
Jan 1999) distributions of mingw32 runtime and w32api headers.
*ada/sysdep.c: Include conio.h if __MINGW32__.
Include termios.h for __CYGWIN__ but not other WINNT targets.
(getc_immediate_common): Test for __CYGWIN__ .
(rts_get_hInstance): Cast return value of GetModuleHandleA
to char*.
Other cleanup is probably also needed, for example using
HAVE_TERMIOS_H rather than long list of target defines, but I was hoping
someone on the Gnat team would handle that.
If not, I will attempt.
Danny
Index: ada/sysdep.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/sysdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 sysdep.c
--- sysdep.c 2001/11/25 13:09:31 1.5
+++ sysdep.c 2001/12/17 00:41:15
@@ -172,6 +172,7 @@ __gnat_set_text_mode (handle)
#ifdef __MINGW32__
#include <windows.h>
+#include <conio.h> /* for getch(), kbhit() */
/* Return the name of the tty. Under windows there is no name for
the tty, so this function, if connected to a tty, returns the generic
name
@@ -291,7 +292,8 @@ __gnat_ttyname (filedes)
#endif
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__)
\
- || (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT)
\
+ || (defined (__osf__) && ! defined (__alpha_vxworks)) \
+ || defined (__CYGWIN__) || || defined (__CYGWIN32__) \
|| defined (__MACHTEN__)
#include <termios.h>
@@ -346,8 +348,8 @@ getc_immediate_common (stream, ch, end_o
int waiting;
{
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__)
\
- || (defined (__osf__) && ! defined (__alpha_vxworks)) \
- || defined (__CYGWIN32__) || defined (__MACHTEN__)
+ || defined (__CYGWIN__) || || defined (__CYGWIN32__) \
+ || defined (__MACHTEN__)
char c;
int nread;
int good_one = 0;
@@ -529,7 +531,7 @@ int rts_get_nShowCmd PARAMS ((voi
char *
rts_get_hInstance ()
{
- return GetModuleHandleA (0);
+ return (char*) GetModuleHandleA (0);
}
char *
http://greetings.yahoo.com.au - Yahoo! Greetings
- Send your festive greetings online!