Exemple #1
0
        /// <summary>
        /// Read from the input port and evaluate whatever is there.
        /// Done for the side effect, not the result.
        /// Since the result is never tested, asynchronous suspensions do not prevent the rest
        /// of the file from being loaded.
        /// </summary>
        /// <param name="inp">The input port.</param>
        /// <param name="outp">If not null, input and results are written here.</param>
        /// <returns>Undefined instance.</returns>
        internal SchemeObject Load(InputPort inp, OutputPort outp)
        {
            while (true)
            {
                SchemeObject input;
                if ((input = inp.Read()) is Eof)
                {
                    inp.Close();
                    return Undefined.Instance;
                }

                if (outp != null)
                {
                    outp.WriteLine("> " + input);
                }

                var res = this.Eval(input);
                if (outp != null)
                {
                    outp.WriteLine(res.ToString());
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Dump the counters on the console.
 /// </summary>
 /// <param name="port">The port to dump to.</param>
 /// <returns>The result is unspecified.</returns>
 private SchemeObject DumpCounters(OutputPort port)
 {
     Contract.Requires(port != null);
     var sb = new StringBuilder();
     this.Dump(sb);
     port.WriteLine(sb.ToString());
     return Undefined.Instance;
 }