Beispiel #1
0
        static Clojure()
        {
            RT.Init();

            Symbol edn = (Symbol)var("clojure.core", "symbol").invoke("clojure.edn");

            var("clojure.core", "require").invoke(edn);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            RT.Init();

            TextWriter outTW = (TextWriter)RT.OutVar.deref();
            TextWriter errTW = RT.errPrintWriter();

            string path = Environment.GetEnvironmentVariable(PATH_PROP);

            path = path ?? ".";

            string warnVal          = Environment.GetEnvironmentVariable(REFLECTION_WARNING_PROP);
            bool   warnOnReflection = warnVal == null ? false : warnVal.Equals("true");
            string mathVal          = Environment.GetEnvironmentVariable(UNCHECKED_MATH_PROP);
            object uncheckedMath    = false;

            if ("true".Equals(mathVal))
            {
                uncheckedMath = true;
            }
            else if ("warn-on-boxed".Equals(mathVal))
            {
                uncheckedMath = Keyword.intern("warn-on-boxed");
            }


            // Force load to avoid transitive compilation during lazy load
            Compiler.EnsureMacroCheck();

            try
            {
                Var.pushThreadBindings(RT.map(
                                           Compiler.CompilePathVar, path,
                                           RT.WarnOnReflectionVar, warnOnReflection,
                                           RT.UncheckedMathVar, uncheckedMath
                                           ));

                Stopwatch sw = new Stopwatch();

                foreach (string lib in args)
                {
                    sw.Reset();
                    sw.Start();
                    outTW.Write("Compiling {0} to {1}", lib, path);
                    outTW.Flush();
                    Compiler.CompileVar.invoke(Symbol.intern(lib));
                    sw.Stop();
                    outTW.WriteLine(" -- {0} milliseconds.", sw.ElapsedMilliseconds);
                }
            }
            catch (Exception e)
            {
                errTW.WriteLine(e.ToString());
                Environment.Exit(1);
            }
            finally
            {
                Var.popThreadBindings();
                try {
                    outTW.Flush();
                }
                catch (IOException e)
                {
                    errTW.WriteLine(e.StackTrace);
                }
            }
        }
Beispiel #3
0
 private void Awake()
 {
     RT.Init(ResolutionX, ResolutionX);
 }
Beispiel #4
0
 public static void legacy_script(string[] args)
 {
     RT.Init();
     REQUIRE.invoke(CLOJURE_MAIN);
     LEGACY_SCRIPT.invoke(RT.seq(args));
 }
Beispiel #5
0
 public static void legacy_repl(string[] args)
 {
     RT.Init();
     REQUIRE.invoke(CLOJURE_MAIN);
     LEGACY_REPL.invoke(RT.seq(args));
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     RT.Init();
     REQUIRE.invoke(CLOJURE_MAIN);
     MAIN.applyTo(RT.seq(args));
 }