summaryrefslogtreecommitdiff
path: root/src/cli/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/runtime')
-rw-r--r--src/cli/runtime/Module.cs9
-rw-r--r--src/cli/runtime/RT.cs7
-rw-r--r--src/cli/runtime/Var.cs3
3 files changed, 17 insertions, 2 deletions
diff --git a/src/cli/runtime/Module.cs b/src/cli/runtime/Module.cs
index e2c091fe..3e396783 100644
--- a/src/cli/runtime/Module.cs
+++ b/src/cli/runtime/Module.cs
@@ -52,7 +52,14 @@ static public Module findOrCreate(String name)
return ns;
}
}
-
+
+public Var find(Symbol sym){
+ lock(vars)
+ {
+ return (Var) vars[sym];
+ }
+}
+
static public Var intern(String ns, String name)
{
return findOrCreate(ns).intern(Symbol.intern(name));
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs
index bb0c3886..7a932f78 100644
--- a/src/cli/runtime/RT.cs
+++ b/src/cli/runtime/RT.cs
@@ -13,6 +13,7 @@
using System;
using System.Collections;
using System.IO;
+using System.Threading;
namespace clojure.lang
{
@@ -27,6 +28,12 @@ public class RT
static public readonly Object[] chars;
+ static int id = 1;
+ static public int nextID()
+ {
+ return Interlocked.Increment(ref id);
+ }
+
static RT(){
chars = new Object[256];
for(int i=0;i<chars.Length;i++)
diff --git a/src/cli/runtime/Var.cs b/src/cli/runtime/Var.cs
index 626c4f48..d2fae255 100644
--- a/src/cli/runtime/Var.cs
+++ b/src/cli/runtime/Var.cs
@@ -15,7 +15,8 @@ namespace clojure.lang
{
public class Var : AFn
{
-public readonly Symbol name; public Module module; public Binding binding; IPersistentMap threadBindings = PersistentArrayMap.EMPTY; int tcount = 0; internal Var(Symbol sym, Module ns) { if(sym.GetType() != typeof(Symbol)) throw new ArgumentException("Only simple symbols can be var names"); this.module = ns; this.name = sym; } override public String ToString() { if(module == null) return "#:" + name; return module.name + ":" + name; } public Var bind(Object val) { lock(this){ if(binding == null)
+public readonly Symbol name; public Module module; public Binding binding;
+public bool hidden = false; IPersistentMap threadBindings = PersistentArrayMap.EMPTY; int tcount = 0; internal Var(Symbol sym, Module ns) { if(sym.GetType() != typeof(Symbol)) throw new ArgumentException("Only simple symbols can be var names"); this.module = ns; this.name = sym; } override public String ToString() { if(module == null) return "#:" + name; return module.name + ":" + name; } public Var bind(Object val) { lock(this){ if(binding == null)
binding = new Binding(val); else binding.val = val;
return this; } } public Object getValue() {