summaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/clojure/runtime/AFn.java101
-rw-r--r--src/org/clojure/runtime/AGenerator.java25
-rw-r--r--src/org/clojure/runtime/Accessor.java81
-rw-r--r--src/org/clojure/runtime/BigNum.java220
-rw-r--r--src/org/clojure/runtime/Binding.java25
-rw-r--r--src/org/clojure/runtime/Box.java23
-rw-r--r--src/org/clojure/runtime/Cons.java37
-rw-r--r--src/org/clojure/runtime/DoubleNum.java244
-rw-r--r--src/org/clojure/runtime/FixNum.java239
-rw-r--r--src/org/clojure/runtime/FloatNum.java17
-rw-r--r--src/org/clojure/runtime/FnSeq.java30
-rw-r--r--src/org/clojure/runtime/IFn.java34
-rw-r--r--src/org/clojure/runtime/IMapEntry.java17
-rw-r--r--src/org/clojure/runtime/IObj.java26
-rw-r--r--src/org/clojure/runtime/IPersistentMap.java31
-rw-r--r--src/org/clojure/runtime/ISeq.java24
-rw-r--r--src/org/clojure/runtime/ISequential.java18
-rw-r--r--src/org/clojure/runtime/Indexer.java16
-rw-r--r--src/org/clojure/runtime/IntegerNum.java17
-rw-r--r--src/org/clojure/runtime/Iter.java38
-rw-r--r--src/org/clojure/runtime/IteratorIter.java44
-rw-r--r--src/org/clojure/runtime/Keyword.java89
-rw-r--r--src/org/clojure/runtime/LineNumberingPushbackReader.java27
-rw-r--r--src/org/clojure/runtime/Namespace.java70
-rw-r--r--src/org/clojure/runtime/Num.java220
-rw-r--r--src/org/clojure/runtime/Obj.java44
-rw-r--r--src/org/clojure/runtime/PersistentArray.java350
-rw-r--r--src/org/clojure/runtime/PersistentArrayIdentityMap.java35
-rw-r--r--src/org/clojure/runtime/PersistentArrayMap.java212
-rw-r--r--src/org/clojure/runtime/PersistentHashtableIdentityMap.java96
-rw-r--r--src/org/clojure/runtime/PersistentHashtableMap.java255
-rw-r--r--src/org/clojure/runtime/PersistentHybridIdentityMap.java47
-rw-r--r--src/org/clojure/runtime/PersistentHybridMap.java104
-rw-r--r--src/org/clojure/runtime/PersistentListIdentityMap.java286
-rw-r--r--src/org/clojure/runtime/PersistentListMap.java290
-rw-r--r--src/org/clojure/runtime/PersistentTree.java809
-rw-r--r--src/org/clojure/runtime/RT.java319
-rw-r--r--src/org/clojure/runtime/RatioNum.java226
-rw-r--r--src/org/clojure/runtime/RationalNum.java17
-rw-r--r--src/org/clojure/runtime/RealNum.java17
-rw-r--r--src/org/clojure/runtime/Reflector.java320
-rw-r--r--src/org/clojure/runtime/RestFn0.java60
-rw-r--r--src/org/clojure/runtime/RestFn1.java65
-rw-r--r--src/org/clojure/runtime/RestFn2.java66
-rw-r--r--src/org/clojure/runtime/RestFn3.java67
-rw-r--r--src/org/clojure/runtime/RestFn4.java70
-rw-r--r--src/org/clojure/runtime/RestFn5.java73
-rw-r--r--src/org/clojure/runtime/Symbol.java84
-rw-r--r--src/org/clojure/runtime/TObj.java37
-rw-r--r--src/org/clojure/runtime/TRef.java33
-rw-r--r--src/org/clojure/runtime/TVal.java39
-rw-r--r--src/org/clojure/runtime/ThreadLocalData.java37
-rw-r--r--src/org/clojure/runtime/Transaction.java236
-rw-r--r--src/org/clojure/runtime/Var.java142
-rw-r--r--src/org/clojure/tools/TypeDump.java199
55 files changed, 0 insertions, 6348 deletions
diff --git a/src/org/clojure/runtime/AFn.java b/src/org/clojure/runtime/AFn.java
deleted file mode 100644
index 6cfd3324..00000000
--- a/src/org/clojure/runtime/AFn.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 25, 2006 4:05:37 PM */
-
-package org.clojure.runtime;
-
-public class AFn extends Obj implements IFn{
-
-public Object invoke() throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1) throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1, Object arg2) throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3) throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4) throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
- throws Exception
- {
- return throwArity();
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, ISeq args)
- throws Exception
- {
- return throwArity();
- }
-
-public Object applyTo( ISeq arglist) throws Exception {
- return applyToHelper(this, arglist);
-}
-static public Object applyToHelper(IFn ifn, ISeq arglist) throws Exception
- {
- switch(RT.boundedLength(arglist, 5))
- {
- case 0:
- return ifn.invoke();
- case 1:
- return ifn.invoke( arglist.first());
- case 2:
- return ifn.invoke( arglist.first()
- , (arglist = arglist.rest()).first()
- );
- case 3:
- return ifn.invoke( arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- );
- case 4:
- return ifn.invoke( arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- );
- case 5:
- return ifn.invoke( arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- );
- default:
- return ifn.invoke( arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , arglist.rest());
- }
- }
-
-public static Object throwArity()
- {
- throw new IllegalArgumentException("Wrong number of args passed");
- }
-}
diff --git a/src/org/clojure/runtime/AGenerator.java b/src/org/clojure/runtime/AGenerator.java
deleted file mode 100644
index 03b35dac..00000000
--- a/src/org/clojure/runtime/AGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Apr 3, 2006 */
-
-package org.clojure.runtime;
-
-public abstract class AGenerator implements Iter{
-
-Object __val;
-int __state = 0;
-
-public Object get()
- {
- return __val;
- }
-
-}
diff --git a/src/org/clojure/runtime/Accessor.java b/src/org/clojure/runtime/Accessor.java
deleted file mode 100644
index 2fb5dc20..00000000
--- a/src/org/clojure/runtime/Accessor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Apr 19, 2006 */
-
-package org.clojure.runtime;
-
-public class Accessor extends Symbol implements IFn{
-
-String memberName;
-Accessor(String name)
- {
- super(name);
- memberName = name.substring(1);
- }
-
-
-public Object invoke() throws Exception {
- return AFn.throwArity();
-}
-/**
- * Indexer implements IFn for attr access
- * This single arg version is the getter
- * @param obj - must be Obj
- * @return the value of the attr or nil if not found
- * @throws Exception
- */
-public Object invoke( Object obj) throws Exception
- {
-
- return Reflector.invokeInstanceMember(memberName,obj);
- }
-
-/**
- * Indexer implements IFn for attr access
- * This two arg version is the setter
- * @param obj - must be Obj
- * @param val
- * @return val
- * @throws Exception
- */
-public Object invoke( Object obj, Object val) throws Exception
- {
-
- return Reflector.invokeInstanceMember(memberName,obj,val);
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3) throws Exception
- {
- return Reflector.invokeInstanceMember(memberName,arg1,arg2,arg3);
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4) throws Exception
- {
- return Reflector.invokeInstanceMember(memberName,arg1,arg2,arg3,arg4);
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
- throws Exception
- {
- return Reflector.invokeInstanceMember(memberName,arg1,arg2,arg3,arg4,arg5);
- }
-
-public Object invoke( Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, ISeq args)
- throws Exception
- {
- return Reflector.invokeInstanceMember(memberName,arg1,arg2,arg3,arg4,arg5,args);
- }
-
-public Object applyTo( ISeq arglist) throws Exception {
- return AFn.applyToHelper(this, arglist);
-}
-
-}
diff --git a/src/org/clojure/runtime/BigNum.java b/src/org/clojure/runtime/BigNum.java
deleted file mode 100644
index a032ca89..00000000
--- a/src/org/clojure/runtime/BigNum.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 28, 2006 10:08:33 AM */
-
-package org.clojure.runtime;
-
-import java.math.BigInteger;
-
-public class BigNum extends IntegerNum{
-public BigInteger val;
-
-public boolean equals(Object arg0)
- {
- return arg0 != null
- && arg0 instanceof BigNum
- && ((BigNum) arg0).val == val;
- }
-
-public int hashCode()
- {
- return val.hashCode();
- }
-
-public String toString()
- {
- return val.toString();
- }
-
-public BigNum(long val)
- {
- this.val = BigInteger.valueOf(val);
- }
-
-public BigNum(BigInteger val)
- {
- this.val = val;
- }
-
-public double doubleValue()
- {
- return val.doubleValue();
- }
-
-public float floatValue()
- {
- return val.floatValue();
- }
-
-public int intValue()
- {
- return val.intValue();
- }
-
-public long longValue()
- {
- return val.longValue();
- }
-
-public boolean equiv(Num rhs)
- {
- return rhs.equivTo(val);
- }
-
-public boolean equivTo(BigInteger x)
- {
- return x.equals(val);
- }
-
-public boolean equivTo(int x)
- {
- //must be outside of range of int or would be one itself
- return false;
- }
-
-public boolean equivTo(RatioNum x)
- {
- //wouldn't still be a RatioNum if it was an integer
- return false;
- }
-
-public boolean lt(Num rhs)
- {
- return rhs.gt(val);
- }
-
-public boolean gt(BigInteger x)
- {
- return x.compareTo(val) < 0;
- }
-
-public boolean gt(int x)
- {
- return BigInteger.valueOf(x).compareTo(val) < 0;
- }
-
-public boolean gt(RatioNum x)
- {
- return x.numerator.lt(x.denominator.multiply(val));
- }
-
-public Num add(Num rhs)
- {
- return rhs.addTo(val);
- }
-
-public Num addTo(BigInteger x)
- {
- return Num.from(x.add(val));
- }
-
-public Num addTo(int x)
- {
- return Num.from(val.add(BigInteger.valueOf(x)));
- }
-
-public Num addTo(RatioNum x)
- {
- return x.addTo(val);
- }
-
-public Num subtractFrom(Num x)
- {
- return x.addTo(val.negate());
- }
-
-public Num multiplyBy(Num rhs)
- {
- return rhs.multiply(val);
- }
-
-public Num multiply(BigInteger x)
- {
- return Num.from(x.multiply(val));
- }
-
-public Num multiply(int x)
- {
- return Num.from(val.multiply(BigInteger.valueOf(x)));
- }
-
-public Num multiply(RatioNum x)
- {
- return x.multiply(val);
- }
-
-public Num divideBy(Num rhs)
- {
- return rhs.divide(val);
- }
-
-public Num divide(BigInteger n)
- {
- return Num.divide(n, val);
- }
-
-public Num divide(int n)
- {
- return Num.divide(BigInteger.valueOf(n), val);
- }
-
-public Num divide(RatioNum x)
- {
- return Num.divide(x.numerator, x.denominator.multiply(val));
- }
-
-public Object truncateDivide( Num num)
- {
- return num.truncateBy( val);
- }
-
-public Object truncateBy( int div)
- {
- return Num.truncateBigints( val, BigInteger.valueOf(div));
- }
-
-public Object truncateBy( BigInteger div)
- {
- return Num.truncateBigints( val, div);
- }
-
-public Object truncateBy( RatioNum div)
- {
- Num q = (Num) Num.truncate( div.denominator.multiply(val), div.numerator);
- return RT.setValues( q, q.multiplyBy(div).subtractFrom(this));
- }
-
-public Num negate()
- {
- return Num.from(val.negate());
- }
-
-public boolean minusp()
- {
- return val.signum() < 0;
- }
-
-public boolean plusp()
- {
- return val.signum() > 0;
- }
-
-public Num oneMinus()
- {
- return Num.from(val.subtract(BigInteger.ONE));
- }
-
-public Num onePlus()
- {
- return Num.from(val.add(BigInteger.ONE));
- }
-}
-
diff --git a/src/org/clojure/runtime/Binding.java b/src/org/clojure/runtime/Binding.java
deleted file mode 100644
index 86fcd5fa..00000000
--- a/src/org/clojure/runtime/Binding.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package org.clojure.runtime;
-
-public class Binding {
-public Object val;
-public Binding rest;
-
-public Binding(Object val) {
- this.val = val;
-}
-
-public Binding(Object val, Binding rest) {
- this.val = val;
- this.rest = rest;
-}
-}
diff --git a/src/org/clojure/runtime/Box.java b/src/org/clojure/runtime/Box.java
deleted file mode 100644
index e1129029..00000000
--- a/src/org/clojure/runtime/Box.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 27, 2006 8:40:19 PM */
-
-package org.clojure.runtime;
-
-public class Box{
-
-public Object val;
-
-public Box(Object val)
- {
- this.val = val;
- }
-}
diff --git a/src/org/clojure/runtime/Cons.java b/src/org/clojure/runtime/Cons.java
deleted file mode 100644
index 1a1c1de9..00000000
--- a/src/org/clojure/runtime/Cons.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 25, 2006 11:01:29 AM */
-
-package org.clojure.runtime;
-
-public class Cons implements ISeq, ISequential{
-
-private final Object _first;
-private final ISeq _rest;
-
-public Cons(Object first, ISeq rest)
- {
- this._first = first;
- this._rest = rest;
- }
-
-public Object first() {
- return _first;
-}
-
-public ISeq rest() {
- return _rest;
-}
-
-public ISeq seq() {
- return this;
-}
-}
diff --git a/src/org/clojure/runtime/DoubleNum.java b/src/org/clojure/runtime/DoubleNum.java
deleted file mode 100644
index 59ff1428..00000000
--- a/src/org/clojure/runtime/DoubleNum.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Mar 28, 2006 10:13:45 AM */
-
-package org.clojure.runtime;
-
-import java.math.BigInteger;
-import java.math.BigDecimal;
-
-public class DoubleNum extends FloatNum{
-double val;
-
-public DoubleNum(double val)
- {
- this.val = val;
- }
-
-public double doubleValue()
- {
- return val;
- }
-
-public float floatValue()
- {
- return (float) val;
- }
-
-public int intValue()
- {
- return (int) val;
- }
-
-public long longValue()
- {
- return (long) val;
- }
-
-final static BigInteger BIGTEN = BigInteger.valueOf(10);
-
-public Num toRational()
- {
- BigDecimal d = new BigDecimal(val);
- return Num.divide(d.unscaledValue(), BIGTEN.pow(d.scale()));
- }
-
-public boolean equiv(Num rhs)
- {
- if(rhs instanceof RatioNum)
- return equivTo((RatioNum) rhs);
- return val == rhs.doubleValue();
- }
-
-public boolean equivTo(BigInteger x)
- {
- return val == x.doubleValue();
- }
-
-public boolean equivTo(int x)
- {
- return x == val;
- }
-
-public boolean equivTo(RatioNum x)
- {
- return toRational().equivTo(x);
- }
-
-public boolean lt(Num rhs)
- {
- if(rhs instanceof RatioNum)
- return toRational().lt(rhs);
- return val < rhs.doubleValue();
- }
-
-public boolean gt(BigInteger x)
- {
- return val > x.doubleValue();
- }
-
-public boolean gt(int x)
- {
- return val > x;
- }
-
-public boolean gt(RatioNum x)
- {
- return toRational().gt(x);
- }
-
-public Num add(Num rhs)
- {
- return Num.from(val + rhs.doubleValue());
- }
-
-public Num addTo(int x)
- {
- return Num.from(val + x);
- }
-
-public Num addTo(BigInteger x)
- {
- return Num.from(val + x.doubleValue());
- }
-
-public Num addTo(RatioNum x)
- {
- return Num.from(val + x.doubleValue());
- }
-
-public Num subtractFrom(Num x)
- {
- return Num.from(x.doubleValue() - val);
- }
-
-public Num multiplyBy(Num rhs)
- {
- return Num.from(val * rhs.doubleValue());
- }
-
-public Num multiply(int x)
- {
- return Num.from(val * x);
- }
-
-public Num multiply(BigInteger x)
- {
- return Num.from(val * x.doubleValue());
- }
-
-public Num multiply(RatioNum x)
- {
- return Num.from(val * x.doubleValue());
- }
-
-public Num divideBy(Num rhs)
- {
- return Num.from(val / rhs.doubleValue());
- }
-
-public Num divide(int x)
- {
- return Num.from(x / val);
- }
-
-public Num divide(BigInteger x)
- {
- return Num.from(x.doubleValue() / val);
- }
-
-public Num divide(RatioNum x)
- {
- return Num.from(x.doubleValue() / val);
- }
-
-static Object truncate(double n, double d)
- {
- double q = n / d;
- if(q <= Integer.MAX_VALUE && q >= Integer.MIN_VALUE)
- {
- return RT.setValues(Num.from((int) q),
- Num.from(n - ((int) q) * d));
- }
- else
- { //bigint quotient
- Num bq = Num.from(new BigDecimal(q).toBigInteger());
- return RT.setValues(bq,
- Num.from(n - bq.doubleValue() * d));