//The execution context exposes two public properties (an input stream and //an output stream). Programs hosting intercal components can do string communication //by hooking the output stream and calling routines that do a DO READ OUT. //String manipulation is impossible. Suppose an INTERCAL module calls a C# module, and //the C# module wants to do string manipulation on the string stored in ;0. In order //to decipher the characters in the array it will be necessary for the C# module to //where the input tape was positioned when the characters were read in (since strings //are stored as deltas rather than absolute values). For example, if the array contains //{ 65, 1, 1, 1} and LastIn is 68 then you could ostensibly conclude that the string //contains {A B C D}, but this is only true if the array was the last one written to. //In keeping with the spirit of the Turing Text model I think the context //should save the current input tape position whenever a WRITE IN is encountered, //e.g. (0) {65,1,1,1} is enough information to recover "ABCD". //Existing programs continue to work; new components can peek at the value if they want //to do string manipulation. Hopefully we can make this completely transparent //to modules written in INTERCAL. //As of right now I haven't done anything yet to enable this. public void ReadOut(string identifier) { Trace.WriteLine(string.Format("Reading out variable '{0}'", identifier.Length)); var next = Variables[identifier].ToString(); Trace.WriteLine(string.Format("Reading out value '{0}'", next)); if (Variables[identifier] is ArrayVariable) { TextOut.Write(next); } else { TextOut.WriteLine(next); } TextOut.Flush(); }
public void ReadOut(object expression) { Trace.WriteLine(string.Format("Reading out object '{0}'", expression)); TextOut.WriteLine(expression); TextOut.Flush(); }