diff --git a/Nostrand.cs b/Nostrand.cs index 9550a25..e26c279 100644 --- a/Nostrand.cs +++ b/Nostrand.cs @@ -70,8 +70,8 @@ public static Var FindFunction(string name) return null; } - [DllImport("__Internal", EntryPoint = "mono_get_runtime_build_info")] - public extern static string GetMonoVersion(); + // [DllImport("__Internal", EntryPoint = "mono_get_runtime_build_info")] + // public extern static string GetRuntimeVersion(); public static string Version() { @@ -86,17 +86,42 @@ public static string FileToRelativePath(string file) return file.Replace(".clj", "").Replace(".cljc", ""); } + static void BootClojureAndNostrand() + { + var assemblyPath = Path.GetDirectoryName(Assembly.Load("Clojure").Location); + foreach(var cljDll in Directory.EnumerateFiles(assemblyPath, "*.clj.dll")) + { + // Terminal.Message("[loading]", cljDll, ConsoleColor.DarkGray); + Assembly.LoadFile(cljDll); + } + + // Terminal.Message("[booting]", "runtime", ConsoleColor.DarkGray); + RT.Initialize(doRuntimePostBoostrap: false); + // Terminal.Message("[booting]", "clojure/core", ConsoleColor.DarkGray); + RT.TryLoadInitType("clojure/core"); + // Terminal.Message("[booting]", "magic/api", ConsoleColor.DarkGray); + RT.TryLoadInitType("magic/api"); + + // Terminal.Message("[booting]", "establishing root bindings", ConsoleColor.DarkGray); + RT.var("clojure.core", "*eval-form-fn*").bindRoot(RT.var("magic.api", "eval")); + RT.var("clojure.core", "*load-file-fn*").bindRoot(RT.var("magic.api", "runtime-load-file")); + RT.var("clojure.core", "*compile-file-fn*").bindRoot(RT.var("magic.api", "runtime-compile-file")); + + // var loadFunction = RT.var("clojure.core", "*load-fn*"); + // Terminal.Message("[loading]", "nostrand/core", ConsoleColor.DarkGray); + // loadFunction.invoke("nostrand/core"); + RT.TryLoadInitType("nostrand/core"); + // Terminal.Message("[loading]", "nostrand/tasks", ConsoleColor.DarkGray); + // loadFunction.invoke("nostrand/tasks"); + RT.TryLoadInitType("nostrand/tasks"); + } + public static void Main(string[] args) { new Mono.Terminal.LineEditor("#force-mono.terminal-assembly-load#"); + BootClojureAndNostrand(); if (args.Length > 0) { - RuntimeBootstrapFlag._doRTBootstrap = false; - - RT.load("clojure/core"); - RT.load("nostrand/core"); - RT.load("nostrand/tasks"); - AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.Resolve; if (File.Exists("project.edn")) @@ -150,7 +175,7 @@ public static void Main(string[] args) else { Terminal.Message("Nostrand", Version(), ConsoleColor.White); - Terminal.Message("Mono", GetMonoVersion(), ConsoleColor.White); + // Terminal.Message("Mono", GetRuntimeVersion(), ConsoleColor.White); Terminal.Message("Clojure", RT.var("clojure.core", "clojure-version").invoke(), ConsoleColor.White); } } diff --git a/Nostrand.csproj b/Nostrand.csproj index eacbc19..7b1fd9b 100644 --- a/Nostrand.csproj +++ b/Nostrand.csproj @@ -1,4 +1,5 @@ - + + Exe net471 @@ -6,7 +7,7 @@ - + Always @@ -18,16 +19,14 @@ - - References/Clojure.dll - + - + \ No newline at end of file diff --git a/References/Clojure.dll b/References/Clojure.dll index 62bcf4d..accc71d 100755 Binary files a/References/Clojure.dll and b/References/Clojure.dll differ diff --git a/References/Magic.Runtime.dll b/References/Magic.Runtime.dll new file mode 100644 index 0000000..088e194 Binary files /dev/null and b/References/Magic.Runtime.dll differ diff --git a/References/clojure.clr.io.clj.dll b/References/clojure.clr.io.clj.dll new file mode 100755 index 0000000..9037f27 Binary files /dev/null and b/References/clojure.clr.io.clj.dll differ diff --git a/References/clojure.clr.shell.clj.dll b/References/clojure.clr.shell.clj.dll new file mode 100755 index 0000000..afcf5ab Binary files /dev/null and b/References/clojure.clr.shell.clj.dll differ diff --git a/References/clojure.core.clj.dll b/References/clojure.core.clj.dll new file mode 100755 index 0000000..3d4c76b Binary files /dev/null and b/References/clojure.core.clj.dll differ diff --git a/References/clojure.core.protocols.clj.dll b/References/clojure.core.protocols.clj.dll new file mode 100755 index 0000000..80306a8 Binary files /dev/null and b/References/clojure.core.protocols.clj.dll differ diff --git a/References/clojure.core.reducers.clj.dll b/References/clojure.core.reducers.clj.dll new file mode 100755 index 0000000..cc1ef08 Binary files /dev/null and b/References/clojure.core.reducers.clj.dll differ diff --git a/References/clojure.core.server.clj.dll b/References/clojure.core.server.clj.dll new file mode 100755 index 0000000..e02d117 Binary files /dev/null and b/References/clojure.core.server.clj.dll differ diff --git a/References/clojure.core.specs.alpha.clj.dll b/References/clojure.core.specs.alpha.clj.dll new file mode 100755 index 0000000..ba95191 Binary files /dev/null and b/References/clojure.core.specs.alpha.clj.dll differ diff --git a/References/clojure.core_clr.clj.dll b/References/clojure.core_clr.clj.dll new file mode 100755 index 0000000..fcb16e5 Binary files /dev/null and b/References/clojure.core_clr.clj.dll differ diff --git a/References/clojure.core_deftype.clj.dll b/References/clojure.core_deftype.clj.dll new file mode 100755 index 0000000..42d2e50 Binary files /dev/null and b/References/clojure.core_deftype.clj.dll differ diff --git a/References/clojure.core_print.clj.dll b/References/clojure.core_print.clj.dll new file mode 100755 index 0000000..b731fce Binary files /dev/null and b/References/clojure.core_print.clj.dll differ diff --git a/References/clojure.core_proxy.clj.dll b/References/clojure.core_proxy.clj.dll new file mode 100755 index 0000000..8ae4bba Binary files /dev/null and b/References/clojure.core_proxy.clj.dll differ diff --git a/References/clojure.data.clj.dll b/References/clojure.data.clj.dll new file mode 100755 index 0000000..8117078 Binary files /dev/null and b/References/clojure.data.clj.dll differ diff --git a/References/clojure.edn.clj.dll b/References/clojure.edn.clj.dll new file mode 100755 index 0000000..94e4059 Binary files /dev/null and b/References/clojure.edn.clj.dll differ diff --git a/References/clojure.genclass.clj.dll b/References/clojure.genclass.clj.dll new file mode 100755 index 0000000..c28f2e7 Binary files /dev/null and b/References/clojure.genclass.clj.dll differ diff --git a/References/clojure.gvec.clj.dll b/References/clojure.gvec.clj.dll new file mode 100755 index 0000000..170af50 Binary files /dev/null and b/References/clojure.gvec.clj.dll differ diff --git a/References/clojure.instant.clj.dll b/References/clojure.instant.clj.dll new file mode 100755 index 0000000..a46d177 Binary files /dev/null and b/References/clojure.instant.clj.dll differ diff --git a/References/clojure.main.clj.dll b/References/clojure.main.clj.dll new file mode 100755 index 0000000..1ad4076 Binary files /dev/null and b/References/clojure.main.clj.dll differ diff --git a/References/clojure.repl.clj.dll b/References/clojure.repl.clj.dll new file mode 100755 index 0000000..e40bdbe Binary files /dev/null and b/References/clojure.repl.clj.dll differ diff --git a/References/clojure.set.clj.dll b/References/clojure.set.clj.dll new file mode 100755 index 0000000..fcebe1b Binary files /dev/null and b/References/clojure.set.clj.dll differ diff --git a/References/clojure.spec.alpha.clj.dll b/References/clojure.spec.alpha.clj.dll new file mode 100755 index 0000000..0349169 Binary files /dev/null and b/References/clojure.spec.alpha.clj.dll differ diff --git a/References/clojure.spec.gen.alpha.clj.dll b/References/clojure.spec.gen.alpha.clj.dll new file mode 100755 index 0000000..b1a493e Binary files /dev/null and b/References/clojure.spec.gen.alpha.clj.dll differ diff --git a/References/clojure.stacktrace.clj.dll b/References/clojure.stacktrace.clj.dll new file mode 100755 index 0000000..49838c6 Binary files /dev/null and b/References/clojure.stacktrace.clj.dll differ diff --git a/References/clojure.string.clj.dll b/References/clojure.string.clj.dll new file mode 100755 index 0000000..a9e503d Binary files /dev/null and b/References/clojure.string.clj.dll differ diff --git a/References/clojure.template.clj.dll b/References/clojure.template.clj.dll new file mode 100755 index 0000000..f6ad793 Binary files /dev/null and b/References/clojure.template.clj.dll differ diff --git a/References/clojure.test.clj.dll b/References/clojure.test.clj.dll new file mode 100755 index 0000000..e854e1f Binary files /dev/null and b/References/clojure.test.clj.dll differ diff --git a/References/clojure.tools.analyzer.ast.clj.dll b/References/clojure.tools.analyzer.ast.clj.dll new file mode 100755 index 0000000..0dfa0ca Binary files /dev/null and b/References/clojure.tools.analyzer.ast.clj.dll differ diff --git a/References/clojure.tools.analyzer.clj.dll b/References/clojure.tools.analyzer.clj.dll new file mode 100755 index 0000000..d81ea87 Binary files /dev/null and b/References/clojure.tools.analyzer.clj.dll differ diff --git a/References/clojure.tools.analyzer.env.clj.dll b/References/clojure.tools.analyzer.env.clj.dll new file mode 100755 index 0000000..441c62d Binary files /dev/null and b/References/clojure.tools.analyzer.env.clj.dll differ diff --git a/References/clojure.tools.analyzer.passes.cleanup.clj.dll b/References/clojure.tools.analyzer.passes.cleanup.clj.dll new file mode 100755 index 0000000..1cd357b Binary files /dev/null and b/References/clojure.tools.analyzer.passes.cleanup.clj.dll differ diff --git a/References/clojure.tools.analyzer.passes.clj.dll b/References/clojure.tools.analyzer.passes.clj.dll new file mode 100755 index 0000000..24f1261 Binary files /dev/null and b/References/clojure.tools.analyzer.passes.clj.dll differ diff --git a/References/clojure.tools.analyzer.passes.elide_meta.clj.dll b/References/clojure.tools.analyzer.passes.elide_meta.clj.dll new file mode 100755 index 0000000..3520ca4 Binary files /dev/null and b/References/clojure.tools.analyzer.passes.elide_meta.clj.dll differ diff --git a/References/clojure.tools.analyzer.passes.source_info.clj.dll b/References/clojure.tools.analyzer.passes.source_info.clj.dll new file mode 100755 index 0000000..f24efa6 Binary files /dev/null and b/References/clojure.tools.analyzer.passes.source_info.clj.dll differ diff --git a/References/clojure.tools.analyzer.passes.trim.clj.dll b/References/clojure.tools.analyzer.passes.trim.clj.dll new file mode 100755 index 0000000..38a645c Binary files /dev/null and b/References/clojure.tools.analyzer.passes.trim.clj.dll differ diff --git a/References/clojure.tools.analyzer.utils.clj.dll b/References/clojure.tools.analyzer.utils.clj.dll new file mode 100755 index 0000000..bfbcbd7 Binary files /dev/null and b/References/clojure.tools.analyzer.utils.clj.dll differ diff --git a/References/clojure.uuid.clj.dll b/References/clojure.uuid.clj.dll new file mode 100755 index 0000000..92c3da3 Binary files /dev/null and b/References/clojure.uuid.clj.dll differ diff --git a/References/clojure.walk.clj.dll b/References/clojure.walk.clj.dll new file mode 100755 index 0000000..29751ab Binary files /dev/null and b/References/clojure.walk.clj.dll differ diff --git a/References/clojure.zip.clj.dll b/References/clojure.zip.clj.dll new file mode 100755 index 0000000..842ef3c Binary files /dev/null and b/References/clojure.zip.clj.dll differ diff --git a/References/mage.core.clj.dll b/References/mage.core.clj.dll new file mode 100755 index 0000000..92ccdb0 Binary files /dev/null and b/References/mage.core.clj.dll differ diff --git a/References/magic.analyzer.analyze_host_forms.clj.dll b/References/magic.analyzer.analyze_host_forms.clj.dll new file mode 100755 index 0000000..016026f Binary files /dev/null and b/References/magic.analyzer.analyze_host_forms.clj.dll differ diff --git a/References/magic.analyzer.binder.clj.dll b/References/magic.analyzer.binder.clj.dll new file mode 100755 index 0000000..0bc2449 Binary files /dev/null and b/References/magic.analyzer.binder.clj.dll differ diff --git a/References/magic.analyzer.clj.dll b/References/magic.analyzer.clj.dll new file mode 100755 index 0000000..f393288 Binary files /dev/null and b/References/magic.analyzer.clj.dll differ diff --git a/References/magic.analyzer.collect_closed_overs.clj.dll b/References/magic.analyzer.collect_closed_overs.clj.dll new file mode 100755 index 0000000..6111a5f Binary files /dev/null and b/References/magic.analyzer.collect_closed_overs.clj.dll differ diff --git a/References/magic.analyzer.errors.clj.dll b/References/magic.analyzer.errors.clj.dll new file mode 100755 index 0000000..f8f3a9b Binary files /dev/null and b/References/magic.analyzer.errors.clj.dll differ diff --git a/References/magic.analyzer.generated_types.clj.dll b/References/magic.analyzer.generated_types.clj.dll new file mode 100755 index 0000000..99368b0 Binary files /dev/null and b/References/magic.analyzer.generated_types.clj.dll differ diff --git a/References/magic.analyzer.intrinsics.clj.dll b/References/magic.analyzer.intrinsics.clj.dll new file mode 100755 index 0000000..0936d1e Binary files /dev/null and b/References/magic.analyzer.intrinsics.clj.dll differ diff --git a/References/magic.analyzer.literal_reinterpretation.clj.dll b/References/magic.analyzer.literal_reinterpretation.clj.dll new file mode 100755 index 0000000..9d602b5 Binary files /dev/null and b/References/magic.analyzer.literal_reinterpretation.clj.dll differ diff --git a/References/magic.analyzer.loop_bindings.clj.dll b/References/magic.analyzer.loop_bindings.clj.dll new file mode 100755 index 0000000..2291c8c Binary files /dev/null and b/References/magic.analyzer.loop_bindings.clj.dll differ diff --git a/References/magic.analyzer.novel.clj.dll b/References/magic.analyzer.novel.clj.dll new file mode 100755 index 0000000..6bba3fd Binary files /dev/null and b/References/magic.analyzer.novel.clj.dll differ diff --git a/References/magic.analyzer.reflection.clj.dll b/References/magic.analyzer.reflection.clj.dll new file mode 100755 index 0000000..6850604 Binary files /dev/null and b/References/magic.analyzer.reflection.clj.dll differ diff --git a/References/magic.analyzer.remove_local_children.clj.dll b/References/magic.analyzer.remove_local_children.clj.dll new file mode 100755 index 0000000..b9e6501 Binary files /dev/null and b/References/magic.analyzer.remove_local_children.clj.dll differ diff --git a/References/magic.analyzer.typed_passes.clj.dll b/References/magic.analyzer.typed_passes.clj.dll new file mode 100755 index 0000000..bbe2eac Binary files /dev/null and b/References/magic.analyzer.typed_passes.clj.dll differ diff --git a/References/magic.analyzer.types.clj.dll b/References/magic.analyzer.types.clj.dll new file mode 100755 index 0000000..eb272d1 Binary files /dev/null and b/References/magic.analyzer.types.clj.dll differ diff --git a/References/magic.analyzer.uniquify.clj.dll b/References/magic.analyzer.uniquify.clj.dll new file mode 100755 index 0000000..8e7f4f7 Binary files /dev/null and b/References/magic.analyzer.uniquify.clj.dll differ diff --git a/References/magic.analyzer.untyped_passes.clj.dll b/References/magic.analyzer.untyped_passes.clj.dll new file mode 100755 index 0000000..6384b28 Binary files /dev/null and b/References/magic.analyzer.untyped_passes.clj.dll differ diff --git a/References/magic.analyzer.util.clj.dll b/References/magic.analyzer.util.clj.dll new file mode 100755 index 0000000..ecf1bff Binary files /dev/null and b/References/magic.analyzer.util.clj.dll differ diff --git a/References/magic.api.clj.dll b/References/magic.api.clj.dll new file mode 100755 index 0000000..d488112 Binary files /dev/null and b/References/magic.api.clj.dll differ diff --git a/References/magic.core.clj.dll b/References/magic.core.clj.dll new file mode 100755 index 0000000..cd62440 Binary files /dev/null and b/References/magic.core.clj.dll differ diff --git a/References/magic.emission.clj.dll b/References/magic.emission.clj.dll new file mode 100755 index 0000000..abef6f4 Binary files /dev/null and b/References/magic.emission.clj.dll differ diff --git a/References/magic.interop.clj.dll b/References/magic.interop.clj.dll new file mode 100755 index 0000000..85284eb Binary files /dev/null and b/References/magic.interop.clj.dll differ diff --git a/References/magic.intrinsics.clj.dll b/References/magic.intrinsics.clj.dll new file mode 100755 index 0000000..37f1b23 Binary files /dev/null and b/References/magic.intrinsics.clj.dll differ diff --git a/References/magic.spells.lift_keywords.clj.dll b/References/magic.spells.lift_keywords.clj.dll new file mode 100755 index 0000000..48ac46a Binary files /dev/null and b/References/magic.spells.lift_keywords.clj.dll differ diff --git a/References/magic.spells.lift_vars.clj.dll b/References/magic.spells.lift_vars.clj.dll new file mode 100755 index 0000000..c0a30bc Binary files /dev/null and b/References/magic.spells.lift_vars.clj.dll differ diff --git a/References/magic.util.clj.dll b/References/magic.util.clj.dll new file mode 100755 index 0000000..d3152a7 Binary files /dev/null and b/References/magic.util.clj.dll differ diff --git a/References/nostrand.core.clj.dll b/References/nostrand.core.clj.dll new file mode 100755 index 0000000..819981c Binary files /dev/null and b/References/nostrand.core.clj.dll differ diff --git a/References/nostrand.deps.clj.dll b/References/nostrand.deps.clj.dll new file mode 100755 index 0000000..43c48db Binary files /dev/null and b/References/nostrand.deps.clj.dll differ diff --git a/References/nostrand.deps.github.clj.dll b/References/nostrand.deps.github.clj.dll new file mode 100755 index 0000000..450d069 Binary files /dev/null and b/References/nostrand.deps.github.clj.dll differ diff --git a/References/nostrand.deps.maven.clj.dll b/References/nostrand.deps.maven.clj.dll new file mode 100755 index 0000000..3fb5f90 Binary files /dev/null and b/References/nostrand.deps.maven.clj.dll differ diff --git a/References/nostrand.deps.nuget.clj.dll b/References/nostrand.deps.nuget.clj.dll new file mode 100755 index 0000000..36cd657 Binary files /dev/null and b/References/nostrand.deps.nuget.clj.dll differ diff --git a/References/nostrand.deps.shell.clj.dll b/References/nostrand.deps.shell.clj.dll new file mode 100755 index 0000000..581037b Binary files /dev/null and b/References/nostrand.deps.shell.clj.dll differ diff --git a/References/nostrand.repl.clj.dll b/References/nostrand.repl.clj.dll new file mode 100755 index 0000000..e2ca870 Binary files /dev/null and b/References/nostrand.repl.clj.dll differ diff --git a/References/nostrand.tasks.clj.dll b/References/nostrand.tasks.clj.dll new file mode 100755 index 0000000..eefb709 Binary files /dev/null and b/References/nostrand.tasks.clj.dll differ diff --git a/nostrand/bootstrap.clj b/nostrand/bootstrap.clj index cce4a92..9499713 100644 --- a/nostrand/bootstrap.clj +++ b/nostrand/bootstrap.clj @@ -1,8 +1,7 @@ (ns nostrand.bootstrap) (defn full-aot [] - (binding [*compile-path* "." - *compile-files* true] - (require 'nostrand.core :reload-all) - (require 'nostrand.tasks :reload-all) - (require 'nostrand.repl :reload-all))) \ No newline at end of file + (binding [clojure.core/*loaded-libs* (ref (sorted-set))] + (compile 'nostrand.core) + (compile 'nostrand.tasks) + (compile 'nostrand.repl))) \ No newline at end of file diff --git a/nostrand/core.clj b/nostrand/core.clj index 818e040..476c3cf 100644 --- a/nostrand/core.clj +++ b/nostrand/core.clj @@ -28,7 +28,12 @@ (defn update-load-path [] (Environment/SetEnvironmentVariable "CLOJURE_LOAD_PATH" - (string/join Path/PathSeparator @-load-path))) + (string/join Path/PathSeparator @-load-path)) + (alter-var-root #'*load-paths* + (fn [load-paths] + (mapv + #(System.IO.Path/GetFullPath %) + (concat @-load-path load-paths))))) (defn set-load-path [val] (reset! -load-path val) diff --git a/nostrand/repl.clj b/nostrand/repl.clj index b0f9050..00c519e 100644 --- a/nostrand/repl.clj +++ b/nostrand/repl.clj @@ -8,7 +8,7 @@ [System.Net IPEndPoint IPAddress] [System.Net.Sockets UdpClient SocketException] [Nostrand Nostrand Terminal] - ; [Mono.Terminal LineEditor] + [Mono.Terminal LineEditor] )) (defn- prompt [] diff --git a/nostrand/tasks.clj b/nostrand/tasks.clj index 4bf0144..7e0f655 100644 --- a/nostrand/tasks.clj +++ b/nostrand/tasks.clj @@ -20,7 +20,7 @@ (defn version [] (msg "Nostrand" (Nostrand/Version)) - (msg "Mono" (Nostrand/GetMonoVersion)) + ;; (msg "Mono" (Nostrand/GetMonoVersion)) (msg "Clojure" (clojure-version))) (defn cli-repl [args]