public static SObject op1_creg_set(SObject arg) { Cont.setCC(arg); return(Factory.Unspecified); }
// MainHelper takes the argument vector, executes the body of the caller's // assembly (should be the assembly corresponding to the compiled scheme // code) and then executes the "go" procedure, if available. public static void MainHelper(string[] args) { Console.WriteLine("CommonLarceny"); Console.WriteLine("CLR, Version={0}", System.Environment.Version); Console.WriteLine("{0}", System.Reflection.Assembly.GetExecutingAssembly()); Console.WriteLine("{0}", System.Reflection.Assembly.GetCallingAssembly()); Console.WriteLine(""); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); // Debug.WriteLine ("CLR Version: {0}", System.Environment.Version); Debug.WriteLine("DEBUG version of Scheme runtime."); Debug.WriteLine(test_checked() ? "CHECKED arithmetic" : "UNCHECKED arithmetic"); { // Establish invariant that LARCENY_ROOT has been set before we // invoke (interactive-entry-point ...) string lar_root = Environment.GetEnvironmentVariable("LARCENY_ROOT"); if (lar_root == null) { Type[] argtypes = { typeof(string), typeof(string) }; MethodInfo method; string location = Assembly.GetCallingAssembly().Location; lar_root = System.IO.Path.GetDirectoryName(location); // By reflection: // Environment.SetEnvironmentVariable("LARCENY_ROOT", lar_root); try { method = typeof(Environment).GetMethod("SetEnvironmentVariable", argtypes); method.Invoke(null, new Object[] { "LARCENY_ROOT", lar_root }); } catch (Exception e) { throw new Exception("Couldn't set LARCENY_ROOT; please " + "set it and try again: ", e); } } } // Mono throws a not implemented exception here. try { InitializePerformanceCounters(); } catch (Exception) {}; Debug.WriteLine("Initializing fixnum pool."); SFixnum.Initialize(); Debug.WriteLine("Initializing immediates."); SImmediate.Initialize(); Debug.WriteLine("Initializing char pool."); SChar.Initialize(); Debug.WriteLine("Initializing registers."); Reg.Initialize(Assembly.GetCallingAssembly()); Cont.Initialize(); bool keepRunning = handleAssembly(Reg.programAssembly); if (keepRunning) { handleGo(args); } }
/* ===================================================== */ /* Misc */ /* ===================================================== */ /* Continuation manipulation */ /* ------------------------- */ public static SObject op1_creg(SObject unused) { return(Cont.getCC()); }