+2009-09-16 Thomas Quinot <quinot@adacore.com>
+
+ * s-oscons-tmplt.c (Target_OS, Target_Name): New constants.
+ * g-expect.adb (Set_Up_Child_Communications): Use
+ System.OS_Constants.Target_OS to determine whether running on Windows.
+
2009-09-14 Richard Henderson <rth@redhat.com>
* gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR.
-- --
------------------------------------------------------------------------------
-with System; use System;
-with Ada.Calendar; use Ada.Calendar;
+with System; use System;
+with System.OS_Constants; use System.OS_Constants;
+with Ada.Calendar; use Ada.Calendar;
with GNAT.IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
pragma Warnings (Off, Pipe2);
pragma Warnings (Off, Pipe3);
- On_Windows : constant Boolean := Directory_Separator = '\';
- -- This is ugly, we need a better way of doing this test ???
-
Input : File_Descriptor;
Output : File_Descriptor;
Error : File_Descriptor;
+ No_Fork_On_Target : constant Boolean := Target_OS = Windows;
+
begin
- if On_Windows then
+ if No_Fork_On_Target then
-- Since Windows does not have a separate fork/exec, we need to
-- perform the following actions:
#endif
+#define STR(x) STR1(x)
+#define STR1(x) #x
+
#ifdef __MINGW32__
unsigned int _CRT_fmode = _O_BINARY;
#endif
** General constants (all platforms)
**/
+/*
+
+ -----------------------------
+ -- 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 := " STR(TARGET_OS) ";")
/*
-------------------