public PassiveExpression Prout(PassiveExpression expression) { if (expression == null) return null; //Console.WriteLine("{0}", expression.ToStringBuilder(0)); ScriptThread.App.WriteLine(expression.ToStringBuilder(0).ToString()); return null; }
public PassiveExpression Prout(PassiveExpression expression) { if (expression == null) { return(null); } ScriptThread.App.Console.WriteLine(expression.ToStringBuilder(0).ToString()); return(null); }
public static PassiveExpression _Prout(PassiveExpression expression) { if (expression == null) { return(null); } Console.WriteLine("{0}", expression.ToStringBuilder(0)); return(null); }
public PassiveExpression Explode(PassiveExpression expression) { // convert expression to string and remove trailing space, if any var sb = expression.ToStringBuilder(0); if (sb.Length > 0 && sb[sb.Length - 1] == ' ') { sb.Length -= 1; } return(PassiveExpression.Build(sb.ToString().ToCharArray())); }
public PassiveExpression Prout(PassiveExpression expression) { if (expression == null) { return(null); } //Console.WriteLine("{0}", expression.ToStringBuilder(0)); EvaluationContext.Write(expression.ToStringBuilder(0).ToString() + Environment.NewLine); return(null); }
// Standard RTL routines public PassiveExpression Print(PassiveExpression expression) { if (expression == null) { return(null); } //Console.WriteLine("{0}", expression.ToStringBuilder(0)); ScriptThread.App.WriteLine(expression.ToStringBuilder(0).ToString()); return(expression); }
public PassiveExpression Open(PassiveExpression expression) { // <Open s.Mode s.D e.File-name> if (expression == null || expression.Count < 1) { throw new ArgumentNullException("s.Mode"); } else if (expression.Count < 2) { throw new ArgumentNullException("s.D"); } string mode = expression[0].ToString().ToUpper(); string handle = expression[1].ToString(); string fileName = string.Format("refal{0}.dat", handle); // fileName can be omitted if (expression.Count > 2) { fileName = expression.ToStringBuilder(2).ToString(); } // R - read, W - write, A - append if (mode.StartsWith("R")) { OpenFiles[handle] = new StreamReader(File.OpenRead(fileName)); } else if (mode.StartsWith("W")) { OpenFiles[handle] = new StreamWriter(File.Create(fileName)); } else if (mode.StartsWith("A")) { OpenFiles[handle] = File.AppendText(fileName); } else { throw new NotSupportedException("Bad file open mode: " + mode + " (R, W, or A expected)"); } // AFAIK, Open don't return anything return(null); }
public PassiveExpression Put(PassiveExpression expression) { if (expression == null || expression.IsEmpty) { return(Prout(expression)); } string handle = expression[0].ToString(); StreamWriter sw = OpenFiles[handle] as StreamWriter; if (sw == null) { return(Prout(expression)); } sw.WriteLine("{0}", expression.ToStringBuilder(1)); PassiveExpression result = PassiveExpression.Build(expression); result.Remove(result[0]); return(result); }
public PassiveExpression Open(PassiveExpression expression) { // <Open s.Mode s.D e.File-name> if (expression == null || expression.Count < 1) throw new ArgumentNullException("s.Mode"); else if (expression.Count < 2) throw new ArgumentNullException("s.D"); string mode = expression[0].ToString().ToUpper(); string handle = expression[1].ToString(); string fileName = string.Format("refal{0}.dat", handle); // fileName can be omitted if (expression.Count > 2) { fileName = expression.ToStringBuilder(2).ToString(); } // R - read, W - write, A - append if (mode.StartsWith("R")) { OpenFiles[handle] = new StreamReader(File.OpenRead(fileName)); } else if (mode.StartsWith("W")) { OpenFiles[handle] = new StreamWriter(File.Create(fileName)); } else if (mode.StartsWith("A")) { OpenFiles[handle] = File.AppendText(fileName); } else { throw new NotSupportedException("Bad file open mode: " + mode + " (R, W, or A expected)"); } // AFAIK, Open don't return anything return null; }
public PassiveExpression Explode(PassiveExpression expression) { // convert expression to string and remove trailing space, if any var sb = expression.ToStringBuilder(0); if (sb.Length > 0 && sb[sb.Length - 1] == ' ') sb.Length -= 1; return PassiveExpression.Build(sb.ToString().ToCharArray()); }
public PassiveExpression Put(PassiveExpression expression) { if (expression == null || expression.IsEmpty) return Prout(expression); string handle = expression[0].ToString(); StreamWriter sw = OpenFiles[handle] as StreamWriter; if (sw == null) return Prout(expression); sw.WriteLine("{0}", expression.ToStringBuilder(1)); PassiveExpression result = PassiveExpression.Build(expression); result.Remove(result[0]); return result; }