Adding Console support for winaot
authorHenric Müller <hemuller@microsoft.com>
Thu, 22 Dec 2016 13:40:55 +0000 (14:40 +0100)
committerHenric Müller <hemuller@microsoft.com>
Wed, 25 Jan 2017 15:29:12 +0000 (16:29 +0100)
Introducing a `MONO_FEATURE_CONSOLE` to be used instead of disabling
Windows specific Console related classes using `MOBILE` ifdef. The
`MONO_FEATURE_CONSOLE` will be set for profiles not setting `NO_CONSOLE`
which currently monodriod and monotouch profiles do.

17 files changed:
mcs/build/profiles/monodroid.make
mcs/build/profiles/monotouch_runtime.make
mcs/build/profiles/orbis.make
mcs/build/profiles/testing_aot_full.make
mcs/build/profiles/testing_aot_hybrid.make
mcs/build/profiles/xammac.make
mcs/class/corlib/Makefile
mcs/class/corlib/System/CStreamReader.cs
mcs/class/corlib/System/CStreamWriter.cs
mcs/class/corlib/System/Console.cs
mcs/class/corlib/System/ConsoleDriver.cs
mcs/class/corlib/System/NullConsoleDriver.cs
mcs/class/corlib/System/TermInfoDriver.cs
mcs/class/corlib/System/TermInfoNumbers.cs
mcs/class/corlib/System/TermInfoReader.cs
mcs/class/corlib/System/TermInfoStrings.cs
mcs/class/corlib/System/WindowsConsoleDriver.cs

index 3b195577a595b969f03c3c5d33a7e5aca80e7aa7..bdc3b91261ed9f4df4a9e6319270718784f0cec8 100644 (file)
@@ -38,3 +38,4 @@ NO_TEST = yes
 NO_INSTALL = yes
 MOBILE_DYNAMIC = yes
 MOBILE_PROFILE = yes
+NO_CONSOLE = yes
index c28ac8bd3ebb49379d1f5d4b8ef07a56946a25ab..4864a935530316e27aec0fe0ee71814db079e425 100644 (file)
@@ -40,5 +40,6 @@ FRAMEWORK_VERSION = 2.1
 NO_INSTALL = yes
 AOT_FRIENDLY_PROFILE = yes
 MOBILE_PROFILE = yes
+NO_CONSOLE = yes
 
 PROFILE_DISABLE_BTLS=1
index edd9f4e210432e4f6bcdbbcca5d4b3eef879e047..b547209cbaa99d94c4dcd1a15477512ce47b7418 100644 (file)
@@ -40,6 +40,7 @@ AOT_FRIENDLY_PROFILE = yes
 ALWAYS_AOT = yes
 MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
+NO_CONSOLE = yes
 
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
index 41c8ac0e1445ff2a3ddfa58b887d1430cba15e17..400e9df1b9ebba194ac5b8c5fda5e87aecc722ad 100644 (file)
@@ -39,6 +39,7 @@ NO_INSTALL = yes
 AOT_FRIENDLY_PROFILE = yes
 MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
+NO_CONSOLE = yes
 
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
index 97ae3b2c3485874577b02b8ed3ad47d47665777e..fcb655ecd417b34ff768cee0ad42134af9ecbdfe 100644 (file)
@@ -33,4 +33,5 @@ FRAMEWORK_VERSION = 2.1
 
 NO_INSTALL = yes
 MOBILE_DYNAMIC = yes
-MOBILE_PROFILE = yes
\ No newline at end of file
+MOBILE_PROFILE = yes
+NO_CONSOLE = yes
index df4773b8785fc81f4cb84b2099825b7905a7ad7a..6e84ebbb91c62eef28818e7d06158f4ad5fe7a9e 100644 (file)
@@ -36,5 +36,6 @@ NO_TEST = yes
 NO_INSTALL = yes
 MOBILE_DYNAMIC = yes
 MOBILE_PROFILE = yes
+NO_CONSOLE = yes
 
 PROFILE_DISABLE_BTLS=1
index a261d0356b6ac0fc8a6217dc81971f53d5ad38f3..d31076229d80205f315b34870c28483a8ce30b04 100644 (file)
@@ -67,6 +67,10 @@ REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_MULTIPLE_APPDOMAINS
 TEST_MCS_FLAGS += -d:MONO_FEATURE_MULTIPLE_APPDOMAINS
 endif
 
+ifndef NO_CONSOLE
+LIB_MCS_FLAGS += -d:MONO_FEATURE_CONSOLE
+endif
+
 WARNING_ABOUT_DISABLED_WARNING=1635
 LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
 DEFAULT_REFERENCES =
index 8e51aed83619d3337586e23874856c2d5120f3af..3e9df0f30e6b5bf9ca465df200074513dfeb697a 100644 (file)
@@ -29,7 +29,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System.Text;
 using System.Runtime.InteropServices;
 
index ff6fc63a25acd9653c5e9e4873f574adc2fda50a..215b0abee8fff054769178487cf67f4173b51748 100644 (file)
@@ -31,7 +31,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System;
 using System.Text;
 
index c8afcf1ec60567a07a651d173cb5374147adde2e..52a43abf1df400e9bdcbdb8e368a3fd4ec3dcffe 100644 (file)
@@ -41,7 +41,7 @@ namespace System
 {
        public static partial class Console
        {
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
                private class WindowsConsole
                {
                        public static bool ctrlHandlerAdded = false;
@@ -96,8 +96,8 @@ namespace System
 
                static Console ()
                {
+#if MONO_FEATURE_CONSOLE
                        if (Environment.IsRunningOnWindows) {
-#if !MOBILE                            
                                //
                                // On Windows, follow the Windows tradition
                                //
@@ -110,8 +110,9 @@ namespace System
                                        // Use Latin 1 as it is fast and UTF-8 is never used as console code page
                                        inputEncoding = outputEncoding = Encoding.Default;
                                }
+                       } else 
 #endif
-                       } else {
+                       {
                                //
                                // On Unix systems (128), do not output the
                                // UTF-8 ZWNBSP (zero-width non-breaking space).
@@ -131,13 +132,13 @@ namespace System
 
                static void SetupStreams (Encoding inputEncoding, Encoding outputEncoding)
                {
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
                        if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole) {
                                stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
                                stdout = TextWriter.Synchronized (new CStreamWriter (OpenStandardOutput (0), outputEncoding, true) { AutoFlush = true });
                                stderr = TextWriter.Synchronized (new CStreamWriter (OpenStandardError (0), outputEncoding, true) { AutoFlush = true });
                        } else
-#endif
+#endif 
                        {
                                stdin = TextReader.Synchronized (new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding));
 
@@ -484,8 +485,7 @@ namespace System
 
                        stdout.WriteLine (String.Format (format, args));
                }
-
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
                public static int Read ()
                {
                        if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) {
@@ -513,7 +513,6 @@ namespace System
                {
                        return stdin.ReadLine ();
                }
-
 #endif
 
                // FIXME: Console should use these encodings when changed
@@ -536,7 +535,7 @@ namespace System
                        }
                }
 
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
                public static ConsoleColor BackgroundColor {
                        get { return ConsoleDriver.BackgroundColor; }
                        set { ConsoleDriver.BackgroundColor = value; }
index 07354a9aeb697ee3e92323a30b84434892f2f95e..c8d5e721bd012ff7e6bf6957c32ae809434b7529 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System.IO;
 using System.Runtime.CompilerServices;
 
index 09cba85976a2f4357ac85b3ea1aef9c13e367e2f..b5dab61788490f18a8e77ca39811dc6665d0b185 100644 (file)
@@ -26,7 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System.Runtime.InteropServices;
 using System.Text;
 namespace System {
index d849b03f8d66dbb4a2106a95baaa950e044ef286..a61a4f08279c5e3ce060cb7173acc3c2a839817e 100644 (file)
@@ -33,7 +33,7 @@
 // https://github.com/dotnet/corefx
 // src/System.Console/src/System/ConsolePal.Unix.cs
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 
 //
 // Defining this writes the output to console.log
index b0b89f225c0292ece8e53139f5ca74ddfe440bc8..ceddd5cea6e08665b12e6d706c0687685d2637ca 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 
 // These values are taken from 'man 5 terminfo' and /usr/include/term.h.
 // They are the indexes for the numeric capabilities in a terminfo file.
index 1a1ec6a94221672c8e17acfaa6be01890f7394df..a171706add61edcfbec5857439ed94057fdebc97 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System.IO;
 using System.Text;
 namespace System {
index d795ef91adcdf1654a15229df81c8536f864e726..728e78cc19e26ed8e7903f6c740ec97061ae2fea 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 
 // These values are taken from 'man 5 terminfo' and /usr/include/term.h.
 // They are the indexes for the string capabilities in a terminfo file.
index 10ba8db45e5afdda5b1afc90d3892f5a6e649e0b..bcf2dd0e08cda105c44ba191331b965b7862e561 100755 (executable)
@@ -26,7 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if !MOBILE
+#if MONO_FEATURE_CONSOLE
 using System.Runtime.InteropServices;
 using System.Text;
 namespace System {