// https://github.com/dotnet/corefx
// src/System.Console/src/System/ConsolePal.Unix.cs
//
-#if !NET_2_1
+#if !MOBILE
//
// Defining this writes the output to console.log
if (!(Console.stdout is CStreamWriter)) {
// Application set its own stdout, we need a reference to the real stdout
- stdout = new CStreamWriter (Console.OpenStandardOutput (0), Console.OutputEncoding);
+ stdout = new CStreamWriter (Console.OpenStandardOutput (0), Console.OutputEncoding, false);
((StreamWriter) stdout).AutoFlush = true;
} else {
stdout = (CStreamWriter) Console.stdout;
case 'O': // logical
int second = stack.Pop().Int32; // it's a stack... the second value was pushed last
int first = stack.Pop().Int32;
- char c = format[pos];
- stack.Push(
- c == '+' ? (first + second) :
- c == '-' ? (first - second) :
- c == '*' ? (first * second) :
- c == '/' ? (first / second) :
- c == 'm' ? (first % second) :
- c == '^' ? (first ^ second) :
- c == '&' ? (first & second) :
- c == '|' ? (first | second) :
- c == '=' ? AsInt(first == second) :
- c == '>' ? AsInt(first > second) :
- c == '<' ? AsInt(first < second) :
- c == 'A' ? AsInt(AsBool(first) && AsBool(second)) :
- c == 'O' ? AsInt(AsBool(first) || AsBool(second)) :
- 0); // not possible; we just validated above
+ int res;
+ switch (format[pos]) {
+ case '+':
+ res = first + second;
+ break;
+ case '-':
+ res = first - second;
+ break;
+ case '*':
+ res = first * second;
+ break;
+ case '/':
+ res = first / second;
+ break;
+ case 'm':
+ res = first % second;
+ break;
+ case '^':
+ res = first ^ second;
+ break;
+ case '&':
+ res = first & second;
+ break;
+ case '|':
+ res = first | second;
+ break;
+ case '=':
+ res = AsInt(first == second);
+ break;
+ case '>':
+ res = AsInt(first > second);
+ break;
+ case '<':
+ res = AsInt(first < second);
+ break;
+ case 'A':
+ res = AsInt(AsBool(first) && AsBool(second));
+ break;
+ case 'O':
+ res = AsInt(AsBool(first) || AsBool(second));
+ break;
+ default:
+ res = 0;
+ break;
+ }
+ stack.Push(res);
break;
// Unary operations