├── src
├── resources
│ └── clojure
│ │ └── version.properties
├── ffi
│ ├── libffi.a
│ ├── ffi.h
│ ├── fficonfig.h
│ ├── ffitarget.h
│ ├── ffitarget_arm64.h
│ └── ffitarget_armv7.h
├── jvm
│ ├── clojure
│ │ ├── lang
│ │ │ ├── ThreadFactory.java
│ │ │ ├── ObjC.java
│ │ │ ├── ObjCClass.java
│ │ │ ├── IllegalAccessError.java
│ │ │ ├── URLClassLoader.java
│ │ │ ├── IType.java
│ │ │ ├── IRecord.java
│ │ │ ├── Sequential.java
│ │ │ ├── Fn.java
│ │ │ ├── IPending.java
│ │ │ ├── IHashEq.java
│ │ │ ├── IReduceInit.java
│ │ │ ├── IDeref.java
│ │ │ ├── Seqable.java
│ │ │ ├── Reversible.java
│ │ │ ├── SourceWriter.java
│ │ │ ├── IMeta.java
│ │ │ ├── IPersistentList.java
│ │ │ ├── IndexedSeq.java
│ │ │ ├── MapEquivalence.java
│ │ │ ├── IReduce.java
│ │ │ ├── ILookupThunk.java
│ │ │ ├── Named.java
│ │ │ ├── RestFnWithMeta.java
│ │ │ ├── IBlockingDeref.java
│ │ │ ├── IKeywordLookup.java
│ │ │ ├── ILookupSite.java
│ │ │ ├── IObj.java
│ │ │ ├── IEditableCollection.java
│ │ │ ├── IMapEntry.java
│ │ │ ├── Settable.java
│ │ │ ├── ILookup.java
│ │ │ ├── Indexed.java
│ │ │ ├── Box.java
│ │ │ ├── IChunk.java
│ │ │ ├── Counted.java
│ │ │ ├── IPersistentStack.java
│ │ │ ├── ITransientCollection.java
│ │ │ ├── IReference.java
│ │ │ ├── ITransientAssociative.java
│ │ │ ├── Reduced.java
│ │ │ ├── IChunkedSeq.java
│ │ │ ├── ITransientVector.java
│ │ │ ├── Associative.java
│ │ │ ├── IPersistentCollection.java
│ │ │ ├── ITransientSet.java
│ │ │ ├── IPersistentSet.java
│ │ │ ├── IPersistentMap.java
│ │ │ ├── IPersistentVector.java
│ │ │ ├── IProxy.java
│ │ │ ├── ITransientMap.java
│ │ │ ├── Sorted.java
│ │ │ ├── package.html
│ │ │ ├── IMapIterable.java
│ │ │ ├── Binding.java
│ │ │ ├── IRef.java
│ │ │ ├── Volatile.java
│ │ │ ├── IExceptionInfo.java
│ │ │ ├── IAtom.java
│ │ │ ├── WarnBoxedMath.java
│ │ │ ├── ISeq.java
│ │ │ ├── SeqEnumeration.java
│ │ │ ├── Obj.java
│ │ │ ├── ChunkBuffer.java
│ │ │ ├── ArityException.java
│ │ │ ├── MapEntry.java
│ │ │ ├── AReference.java
│ │ │ ├── Delay.java
│ │ │ ├── LazilyPersistentVector.java
│ │ │ ├── Cons.java
│ │ │ ├── StringSeq.java
│ │ │ ├── SeqIterator.java
│ │ │ ├── AFunction.java
│ │ │ ├── ATransientSet.java
│ │ │ ├── ExceptionInfo.java
│ │ │ ├── Selector.java
│ │ │ ├── RecordIterator.java
│ │ │ ├── KeywordLookupSite.java
│ │ │ ├── RemoteRepl.java
│ │ │ ├── ChunkedCons.java
│ │ │ ├── ArrayChunk.java
│ │ │ ├── FnLoaderThunk.java
│ │ │ ├── TaggedLiteral.java
│ │ │ ├── ReaderConditional.java
│ │ │ ├── IteratorSeq.java
│ │ │ ├── EnumerationSeq.java
│ │ │ ├── ARef.java
│ │ │ ├── Ratio.java
│ │ │ ├── ProxyHandler.java
│ │ │ ├── MethodImplCache.java
│ │ │ ├── Iterate.java
│ │ │ ├── ATransientMap.java
│ │ │ ├── Atom.java
│ │ │ ├── Cycle.java
│ │ │ ├── XMLHandler.java
│ │ │ ├── PersistentTreeSet.java
│ │ │ ├── Repeat.java
│ │ │ └── LineNumberingPushbackReader.java
│ │ ├── main.java
│ │ ├── asm
│ │ │ └── commons
│ │ │ │ ├── TableSwitchGenerator.java
│ │ │ │ └── package.html
│ │ └── java
│ │ │ └── api
│ │ │ └── package.html
│ └── com
│ │ └── google
│ │ └── j2objc
│ │ └── annotations
│ │ └── ReflectionSupport.java
├── objc
│ ├── NSProxyImpl.h
│ ├── ReplClient.h
│ ├── WeakRef.h
│ ├── NSSocketImpl.h
│ ├── NSTypeImpl.h
│ ├── WeakRef.m
│ ├── NSSocketImpl.m
│ └── Cst502Socket.h
├── script
│ ├── run_test_generative.clj
│ └── run_test.clj
├── clj
│ └── clojure
│ │ ├── uuid.clj
│ │ ├── java
│ │ └── browse_ui.clj
│ │ ├── pprint
│ │ └── print_table.clj
│ │ ├── edn.clj
│ │ ├── template.clj
│ │ ├── pprint.clj
│ │ └── stacktrace.clj
└── assembly
│ ├── slim.xml
│ └── distribution.xml
├── test
├── java
│ ├── java
│ │ └── util
│ │ │ └── jar
│ │ │ ├── JarEntry.java
│ │ │ └── JarFile.java
│ ├── compilation
│ │ └── TestDispatch.java
│ └── clojure
│ │ └── test
│ │ └── ReflectorTryCatchFixture.java
├── clojure
│ └── test_clojure
│ │ ├── repl
│ │ └── example.clj
│ │ ├── protocols
│ │ ├── more_examples.clj
│ │ └── examples.clj
│ │ ├── compilation
│ │ └── examples.clj
│ │ ├── delays.clj
│ │ ├── clojure_xml.clj
│ │ ├── atoms.clj
│ │ ├── annotations.clj
│ │ ├── refs.clj
│ │ ├── pprint.clj
│ │ ├── clojure_zip.clj
│ │ ├── keywords.clj
│ │ ├── java
│ │ ├── javadoc.clj
│ │ └── shell.clj
│ │ ├── volatiles.clj
│ │ ├── pprint
│ │ └── test_helper.clj
│ │ ├── parallel.clj
│ │ ├── edn.clj
│ │ ├── reflect.clj
│ │ ├── data.clj
│ │ ├── try_catch.clj
│ │ ├── api.clj
│ │ ├── main.clj
│ │ ├── special.clj
│ │ ├── transients.clj
│ │ ├── fn.clj
│ │ ├── clojure_walk.clj
│ │ ├── repl.clj
│ │ ├── annotations
│ │ └── java_5.clj
│ │ ├── test_fixtures.clj
│ │ └── macros.clj
└── objc
│ └── NSCommonTest.h
├── CONTRIBUTING.md
├── .gitignore
├── antsetup.sh
├── KNOWN_ISSUES
├── .idea
└── libraries
│ ├── Maven__org_clojure_data_generators_0_1_2.xml
│ └── Maven__org_clojure_test_generative_0_4_0.xml
├── release.sh
├── clojure.iml
└── readme.md
/src/resources/clojure/version.properties:
--------------------------------------------------------------------------------
1 | version=${version}
--------------------------------------------------------------------------------
/src/ffi/libffi.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galdolber/clojure-objc/HEAD/src/ffi/libffi.a
--------------------------------------------------------------------------------
/test/java/java/util/jar/JarEntry.java:
--------------------------------------------------------------------------------
1 | package java.util.jar;
2 |
3 | public class JarEntry {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | If you'd like to submit a patch, please follow the [contributing guidelines](http://clojure.org/contributing).
2 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ThreadFactory.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | public interface ThreadFactory {
4 | Thread newThread(java.lang.Runnable runnable);
5 | }
6 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/repl/example.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.repl.example)
2 |
3 | ;; sample namespace for repl tests, don't add anything here
4 | (defn foo [])
5 | (defn bar [])
6 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ObjC.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | public class ObjC {
4 |
5 | public static boolean objc = false;
6 |
7 | public static void setObjC() {
8 | objc = true;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/objc/NSProxyImpl.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "clojure/lang/APersistentMap.h"
3 |
4 | @interface NSProxyImpl: NSObject
5 |
6 | - (id) initWithClass:(NSString*)clazz map:(ClojureLangAPersistentMap*) m;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/protocols/more_examples.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.protocols.more-examples)
2 |
3 | (defprotocol SimpleProtocol
4 | "example protocol used by clojure tests. Note that
5 | foo collides with examples/ExampleProtocol."
6 |
7 | (foo [a] ""))
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.jar
2 | target
3 | clojure.iws
4 | clojure.ipr
5 | nbproject/private/
6 | maven-classpath
7 | maven-classpath.properties
8 | coclojure/*
9 | .settings/*
10 | .classpath
11 | .project
12 | xcode
13 | .idea/
14 |
15 | settings.xml
16 |
17 | upload-github.sh
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ObjCClass.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | public class ObjCClass {
4 |
5 | private final String name;
6 |
7 | public ObjCClass(String name) {
8 | this.name = name;
9 | }
10 |
11 | public String getName() {
12 | return name;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IllegalAccessError.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | import java.lang.RuntimeException;
4 | import java.lang.String;
5 |
6 | public class IllegalAccessError extends RuntimeException {
7 |
8 | public IllegalAccessError(String msg) {
9 | super(msg);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/script/run_test_generative.clj:
--------------------------------------------------------------------------------
1 | (System/setProperty "java.awt.headless" "true")
2 | (when-not (System/getProperty "clojure.test.generative.msec")
3 | (System/setProperty "clojure.test.generative.msec" "60000"))
4 | (require '[clojure.test.generative.runner :as runner])
5 | (runner/-main "test")
6 |
--------------------------------------------------------------------------------
/antsetup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mvn -q dependency:build-classpath -Dmdep.outputFile=maven-classpath
4 | cat <maven-classpath.properties
5 | maven.compile.classpath=`cat maven-classpath`
6 | maven.test.classpath=`cat maven-classpath`
7 | EOF
8 | echo "Wrote maven-classpath.properties for standalone ant use"
9 |
--------------------------------------------------------------------------------
/test/objc/NSCommonTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSCommonTest.h
3 | // mpos
4 | //
5 | // Created by Gal Dolber on 4/10/14.
6 | // Copyright (c) 2014 zuldi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSCommonTest : NSObject
12 |
13 | + (void) runtests;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/src/ffi/ffi.h:
--------------------------------------------------------------------------------
1 | #ifdef __arm64__
2 |
3 | #include "ffi_arm64.h"
4 |
5 |
6 | #endif
7 | #ifdef __i386__
8 |
9 | #include "ffi_i386.h"
10 |
11 |
12 | #endif
13 | #ifdef __arm__
14 |
15 | #include "ffi_armv7.h"
16 |
17 |
18 | #endif
19 | #ifdef __x86_64__
20 |
21 | #include "ffi_x86_64.h"
22 |
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/KNOWN_ISSUES:
--------------------------------------------------------------------------------
1 | - Dividing by zero doesn't throw an exception in objc, it fails with EXC_ARITHMETIC
2 | - NullPointerException and ClassCastException are not reliable, as they are emulated by j2objc
3 | - Empty regular expressions throw an exception
4 | - pr-str a date have a bad Timezone format: https://code.google.com/p/j2objc/issues/detail?id=321
--------------------------------------------------------------------------------
/src/ffi/fficonfig.h:
--------------------------------------------------------------------------------
1 | #ifdef __arm64__
2 |
3 | #include
4 |
5 |
6 | #endif
7 | #ifdef __i386__
8 |
9 | #include
10 |
11 |
12 | #endif
13 | #ifdef __arm__
14 |
15 | #include
16 |
17 |
18 | #endif
19 | #ifdef __x86_64__
20 |
21 | #include
22 |
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/ffi/ffitarget.h:
--------------------------------------------------------------------------------
1 | #ifdef __arm64__
2 |
3 | #include "ffitarget_arm64.h"
4 |
5 |
6 | #endif
7 | #ifdef __i386__
8 |
9 | #include "ffitarget_i386.h"
10 |
11 |
12 | #endif
13 | #ifdef __arm__
14 |
15 | #include "ffitarget_armv7.h"
16 |
17 |
18 | #endif
19 | #ifdef __x86_64__
20 |
21 | #include "ffitarget_x86_64.h"
22 |
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/src/objc/ReplClient.h:
--------------------------------------------------------------------------------
1 | //
2 | // ReplClient.h
3 | // mpos
4 | //
5 | // Created by Gal Dolber on 4/12/14.
6 | // Copyright (c) 2014 zuldi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ReplClient : NSObject
12 |
13 | +(void) connect: (NSString*) host;
14 | +(id) callRemote:(id)sel args:(id)args;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/src/script/run_test.clj:
--------------------------------------------------------------------------------
1 | (System/setProperty "java.awt.headless" "true")
2 | (require
3 | '[clojure.test :as test]
4 | '[clojure.tools.namespace.find :as ns])
5 | (def namespaces (ns/find-namespaces-in-dir (java.io.File. "test")))
6 | (doseq [ns namespaces] (require ns))
7 | (let [summary (apply test/run-tests namespaces)]
8 | (System/exit (if (test/successful? summary) 0 -1)))
9 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/URLClassLoader.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | import java.net.URL;
4 |
5 | public class URLClassLoader extends ClassLoader {
6 |
7 | public URLClassLoader(URL[] emptyUrls, ClassLoader classLoader) {
8 | super(classLoader);
9 | }
10 |
11 | public void addURL(URL url) {
12 | throw new RuntimeException(url.toString());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/objc/WeakRef.h:
--------------------------------------------------------------------------------
1 | //
2 | // WeakRef.h
3 | // sample
4 | //
5 | // Created by Gal Dolber on 2/14/14.
6 | // Copyright (c) 2014 clojure-objc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface WeakRef : NSObject
12 |
13 | -(id)initWith:(id)o;
14 |
15 | -(id)deref;
16 |
17 | +(WeakRef*)from:(id)o;
18 |
19 | -(BOOL)isEqual:(id)f;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/test/java/compilation/TestDispatch.java:
--------------------------------------------------------------------------------
1 | package compilation;
2 |
3 | public class TestDispatch {
4 | public static String someMethod (int a, int b) {
5 | return "(int, int)";
6 | }
7 |
8 | public static String someMethod (int a, long b) {
9 | return "(int, long)";
10 | }
11 |
12 | public static String someMethod (long a, long b) {
13 | return "(long, long)";
14 | }
15 | }
--------------------------------------------------------------------------------
/src/objc/NSSocketImpl.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSSocketImpl.h
3 | // sample
4 | //
5 | // Created by Gal Dolber on 2/1/14.
6 | // Copyright (c) 2014 clojure-objc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSSocketImpl : NSObject
12 |
13 | - (id) initWithHost:(NSString*)hostName withPort:(NSString*)portNum;
14 |
15 | - (id) read;
16 |
17 | - (void) println: (NSString*) s;
18 |
19 | -(void)close;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/src/objc/NSTypeImpl.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSTypeImpl.h
3 | // sample
4 | //
5 | // Created by Gal Dolber on 2/4/14.
6 | // Copyright (c) 2014 clojure-objc. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "clojure/lang/APersistentMap.h"
11 | #import "clojure/lang/PersistentVector.h"
12 | #import "clojure/lang/PersistentHashMap.h"
13 |
14 | @interface NSTypeImpl : NSObject
15 |
16 | +(Class) makeClassWithName:(NSString*)name superclass:(NSString*)s map:(ClojureLangAPersistentMap*)m;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/protocols/examples.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.protocols.examples)
2 |
3 | (defprotocol ExampleProtocol
4 | "example protocol used by clojure tests"
5 |
6 | (foo [a] "method with one arg")
7 | (bar [a b] "method with two args")
8 | (^String baz [a] [a b] "method with multiple arities")
9 | (with-quux [a] "method name with a hyphen"))
10 |
11 | (defprotocol MarkerProtocol
12 | "a protocol with no methods")
13 |
14 | (defprotocol MarkerProtocol2)
15 |
16 | (definterface ExampleInterface
17 | (hinted [^int i])
18 | (hinted [^String s]))
19 |
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | public interface IType {
14 | }
15 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IRecord.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | public interface IRecord {
14 | }
15 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Sequential.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | /**
4 | * Copyright (c) Rich Hickey. All rights reserved.
5 | * The use and distribution terms for this software are covered by the
6 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
7 | * which can be found in the file epl-v10.html at the root of this distribution.
8 | * By using this software in any fashion, you are agreeing to be bound by
9 | * the terms of this license.
10 | * You must not remove this notice, or any other, from this software.
11 | */
12 | public interface Sequential {
13 | }
14 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Fn.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Nov 25, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Fn{
16 | }
17 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_clojure_data_generators_0_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_clojure_test_generative_0_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPending.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | public interface IPending{
14 | boolean isRealized();
15 | }
16 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/compilation/examples.clj:
--------------------------------------------------------------------------------
1 | ;; Copyright (c) Rich Hickey. All rights reserved.
2 | ;; The use and distribution terms for this software are covered by the
3 | ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ;; which can be found in the file epl-v10.html at the root of this distribution.
5 | ;; By using this software in any fashion, you are agreeing to be bound by
6 | ;; the terms of this license.
7 | ;; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.test-clojure.compilation.examples)
10 |
11 | (eval '(deftype X []))
12 | (deftype T [])
13 |
--------------------------------------------------------------------------------
/release.sh:
--------------------------------------------------------------------------------
1 | export KEEP_META=false
2 | rm -Rf target/release
3 | mkdir target/release
4 | cp target/libclojure-objc.a target/release/
5 | cp $J2OBJC_HOME/lib/libjre_emul.a target/release/
6 | cp src/ffi/libffi.a target/release/
7 | mkdir target/release/include
8 | rsync -a $J2OBJC_HOME/include target/release
9 | rsync -a target/include target/release
10 | cp $J2OBJC_HOME/j2objc target/release/
11 | mkdir target/release/lib
12 | cp $J2OBJC_HOME/lib/j2objc_annotations.jar target/release/lib
13 | cp $J2OBJC_HOME/lib/j2objc.jar target/release/lib
14 | cp $J2OBJC_HOME/lib/jre_emul.jar target/release/lib
15 | cd ./target/release
16 | zip -r ../release.zip .
17 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/delays.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.delays
2 | (:use clojure.test))
3 |
4 | (deftest calls-once
5 | (let [a (atom 0)
6 | d (delay (swap! a inc))]
7 | (is (= 0 @a))
8 | (is (= 1 @d))
9 | (is (= 1 @d))
10 | (is (= 1 @a))))
11 |
12 | (deftest saves-exceptions
13 | (let [f #(do (throw (Exception. "broken"))
14 | 1)
15 | d (delay (f))
16 | try-call #(try
17 | @d
18 | (catch Exception e e))
19 | first-result (try-call)]
20 | (is (instance? Exception first-result))
21 | (is (identical? first-result (try-call)))))
22 |
--------------------------------------------------------------------------------
/test/java/java/util/jar/JarFile.java:
--------------------------------------------------------------------------------
1 | // Empty stub to run tests
2 | package java.util.jar;
3 |
4 | import java.io.File;
5 | import java.io.InputStream;
6 | import java.util.Enumeration;
7 | import java.util.zip.ZipEntry;
8 |
9 |
10 | public class JarFile {
11 |
12 | public JarFile(File file) {
13 | throw new RuntimeException();
14 | }
15 |
16 | public Enumeration entries() {
17 | throw new RuntimeException();
18 | }
19 |
20 | public InputStream getInputStream(ZipEntry zipEntry) {
21 | throw new RuntimeException();
22 | }
23 |
24 | public ZipEntry getEntry(String string) {
25 | throw new RuntimeException();
26 | }
27 | }
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IHashEq.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich 10/23/11 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IHashEq{
16 | int hasheq();
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IReduceInit.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | public interface IReduceInit{
14 | Object reduce(IFn f, Object start) ;
15 | }
16 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IDeref.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Feb 9, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IDeref{
16 | Object deref() ;
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Seqable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jan 28, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Seqable {
16 | ISeq seq();
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Reversible.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jan 5, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Reversible{
16 | ISeq rseq() ;
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/SourceWriter.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | public class SourceWriter {
4 |
5 | private final StringBuilder sb = new StringBuilder();
6 | private int tab = 0;
7 |
8 | public void tab() {
9 | tab++;
10 | }
11 |
12 | public void untab() {
13 | tab --;
14 | }
15 |
16 | public void println(String l) {
17 | if (tab > 0) {
18 | sb.append(new String(new char[tab]).replace("\0", " "));
19 | }
20 | sb.append(l).append("\n");
21 | }
22 |
23 | @Override
24 | public String toString() {
25 | return sb.toString();
26 | }
27 |
28 | public void println() {
29 | sb.append("\n");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IMeta.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Dec 31, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IMeta {
16 | IPersistentMap meta();
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentList.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | */
10 |
11 | package clojure.lang;
12 |
13 |
14 | public interface IPersistentList extends Sequential, IPersistentStack{
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IndexedSeq.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | */
10 |
11 | package clojure.lang;
12 |
13 | public interface IndexedSeq extends ISeq, Sequential, Counted{
14 |
15 | public int index();
16 | }
17 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/MapEquivalence.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Aug 4, 2010 */
12 |
13 | package clojure.lang;
14 |
15 | //marker interface
16 | public interface MapEquivalence{
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IReduce.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jun 11, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IReduce extends IReduceInit{
16 | Object reduce(IFn f) ;
17 | }
18 |
--------------------------------------------------------------------------------
/test/java/clojure/test/ReflectorTryCatchFixture.java:
--------------------------------------------------------------------------------
1 | package clojure.test;
2 |
3 | public class ReflectorTryCatchFixture {
4 |
5 | public static void fail(Long x) throws Cookies {
6 | throw new Cookies("Long");
7 | }
8 |
9 | public static void fail(Double y) throws Cookies {
10 | throw new Cookies("Double");
11 | }
12 |
13 | public void failWithCause(Double y) throws Cookies {
14 | throw new Cookies("Wrapped", new Cookies("Cause"));
15 | }
16 |
17 | public static class Cookies extends Exception {
18 | public Cookies(String msg, Throwable cause) { super(msg, cause); }
19 | public Cookies(String msg) { super(msg); }
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ILookupThunk.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Nov 2, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ILookupThunk{
16 |
17 | Object get(Object target);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Named.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Sep 20, 2007 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Named{
16 | String getNamespace();
17 |
18 | String getName();
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/RestFnWithMeta.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | public class RestFnWithMeta extends RestFn {
4 |
5 | final AFunction aFunction;
6 | final IPersistentMap meta;
7 |
8 | public RestFnWithMeta(AFunction aFunction, IPersistentMap meta) {
9 | this.aFunction = aFunction;
10 | this.meta = meta;
11 | }
12 |
13 | protected Object doInvoke(Object args) {
14 | return aFunction.applyTo((ISeq) args);
15 | }
16 |
17 | public IPersistentMap meta() {
18 | return meta;
19 | }
20 |
21 | public IObj withMeta(IPersistentMap meta) {
22 | return aFunction.withMeta(meta);
23 | }
24 |
25 | public int getRequiredArity() {
26 | return 0;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IBlockingDeref.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich 3/18/11 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IBlockingDeref{
16 | Object deref(long ms, Object timeoutValue) ;
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IKeywordLookup.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Oct 31, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IKeywordLookup{
16 | ILookupThunk getLookupThunk(Keyword k);
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ILookupSite.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Nov 2, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ILookupSite{
16 |
17 | ILookupThunk fault(Object target);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IObj.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 |
14 | public interface IObj extends IMeta {
15 |
16 | public IObj withMeta(IPersistentMap meta);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IEditableCollection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jul 17, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IEditableCollection{
16 | ITransientCollection asTransient();
17 | }
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IMapEntry.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | */
10 |
11 | package clojure.lang;
12 |
13 | import java.util.Map;
14 |
15 | public interface IMapEntry extends Map.Entry{
16 | Object key();
17 |
18 | Object val();
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Settable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Dec 31, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Settable {
16 | Object doSet(Object val) ;
17 | Object doReset(Object val) ;
18 | }
19 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ILookup.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Aug 2, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ILookup{
16 | Object valAt(Object key);
17 |
18 | Object valAt(Object key, Object notFound);
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Indexed.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich May 24, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface Indexed extends Counted{
16 | Object nth(int i);
17 |
18 | Object nth(int i, Object notFound);
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Box.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Mar 27, 2006 8:40:19 PM */
12 |
13 | package clojure.lang;
14 |
15 | public class Box{
16 |
17 | public Object val;
18 |
19 | public Box(Object val){
20 | this.val = val;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IChunk.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jun 18, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IChunk extends Indexed{
16 |
17 | IChunk dropFirst();
18 |
19 | Object reduce(IFn f, Object start) ;
20 | }
21 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Counted.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | /**
4 | * Copyright (c) Rich Hickey. All rights reserved.
5 | * The use and distribution terms for this software are covered by the
6 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
7 | * which can be found in the file epl-v10.html at the root of this distribution.
8 | * By using this software in any fashion, you are agreeing to be bound by
9 | * the terms of this license.
10 | * You must not remove this notice, or any other, from this software.
11 | */
12 |
13 | /* A class that implements Counted promises that it is a collection
14 | * that implement a constant-time count() */
15 |
16 | public interface Counted {
17 | int count();
18 | }
19 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentStack.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Sep 19, 2007 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IPersistentStack extends IPersistentCollection{
16 | Object peek();
17 |
18 | IPersistentStack pop();
19 | }
20 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/clojure_xml.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;;Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.clojure-xml
13 | (:use clojure.test)
14 | (:require [clojure.xml :as xml]))
15 |
16 |
17 | ; parse
18 |
19 | ; emit-element
20 | ; emit
21 |
22 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/atoms.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;;Author: Frantisek Sodomka
10 |
11 | (ns clojure.test-clojure.atoms
12 | (:use clojure.test))
13 |
14 | ; http://clojure.org/atoms
15 |
16 | ; atom
17 | ; deref, @-reader-macro
18 | ; swap! reset!
19 | ; compare-and-set!
20 |
21 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ITransientCollection.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jul 17, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ITransientCollection{
16 |
17 | ITransientCollection conj(Object val);
18 |
19 | IPersistentCollection persistent();
20 | }
21 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IReference.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Dec 31, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IReference extends IMeta {
16 | IPersistentMap alterMeta(IFn alter, ISeq args) ;
17 | IPersistentMap resetMeta(IPersistentMap m);
18 | }
19 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ITransientAssociative.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jul 17, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ITransientAssociative extends ITransientCollection, ILookup{
16 |
17 | ITransientAssociative assoc(Object key, Object val);
18 | }
19 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Reduced.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | public final class Reduced implements IDeref{
14 | Object val;
15 |
16 | public Reduced(Object val){
17 | this.val = val;
18 | }
19 |
20 | public Object deref(){
21 | return val;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/annotations.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;; Authors: Stuart Halloway, Rich Hickey
10 |
11 | (ns clojure.test-clojure.annotations
12 | (:use clojure.test))
13 |
14 | (case (System/getProperty "java.specification.version")
15 | "1.6" (load "annotations/java_6")
16 | nil)
17 |
18 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IChunkedSeq.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich May 24, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IChunkedSeq extends ISeq, Sequential {
16 |
17 | IChunk chunkedFirst() ;
18 |
19 | ISeq chunkedNext() ;
20 |
21 | ISeq chunkedMore() ;
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ITransientVector.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jul 17, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ITransientVector extends ITransientAssociative, Indexed{
16 |
17 | ITransientVector assocN(int i, Object val);
18 |
19 | ITransientVector pop();
20 | }
21 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Associative.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | /**
4 | * Copyright (c) Rich Hickey. All rights reserved.
5 | * The use and distribution terms for this software are covered by the
6 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
7 | * which can be found in the file epl-v10.html at the root of this distribution.
8 | * By using this software in any fashion, you are agreeing to be bound by
9 | * the terms of this license.
10 | * You must not remove this notice, or any other, from this software.
11 | */
12 | public interface Associative extends IPersistentCollection, ILookup{
13 | boolean containsKey(Object key);
14 |
15 | IMapEntry entryAt(Object key);
16 |
17 | Associative assoc(Object key, Object val);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/test/clojure/test_clojure/refs.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.refs
13 | (:use clojure.test))
14 |
15 | ; http://clojure.org/refs
16 |
17 | ; ref
18 | ; deref, @-reader-macro
19 | ; dosync io!
20 | ; ensure ref-set alter commute
21 | ; set-validator get-validator
22 |
23 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentCollection.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | /**
4 | * Copyright (c) Rich Hickey. All rights reserved.
5 | * The use and distribution terms for this software are covered by the
6 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
7 | * which can be found in the file epl-v10.html at the root of this distribution.
8 | * By using this software in any fashion, you are agreeing to be bound by
9 | * the terms of this license.
10 | * You must not remove this notice, or any other, from this software.
11 | */
12 |
13 |
14 | public interface IPersistentCollection extends Seqable {
15 |
16 | int count();
17 |
18 | IPersistentCollection cons(Object o);
19 |
20 | IPersistentCollection empty();
21 |
22 | boolean equiv(Object o);
23 | }
24 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ITransientSet.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Mar 3, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ITransientSet extends ITransientCollection, Counted{
16 | public ITransientSet disjoin(Object key) ;
17 | public boolean contains(Object key);
18 | public Object get(Object key);
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentSet.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Mar 3, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IPersistentSet extends IPersistentCollection, Counted{
16 | public IPersistentSet disjoin(Object key) ;
17 | public boolean contains(Object key);
18 | public Object get(Object key);
19 | }
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentMap.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | */
10 |
11 | package clojure.lang;
12 |
13 |
14 | public interface IPersistentMap extends Iterable, Associative, Counted{
15 |
16 |
17 | IPersistentMap assoc(Object key, Object val);
18 |
19 | IPersistentMap assocEx(Object key, Object val) ;
20 |
21 | IPersistentMap without(Object key) ;
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IPersistentVector.java:
--------------------------------------------------------------------------------
1 | package clojure.lang;
2 |
3 | /**
4 | * Copyright (c) Rich Hickey. All rights reserved.
5 | * The use and distribution terms for this software are covered by the
6 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
7 | * which can be found in the file epl-v10.html at the root of this distribution.
8 | * By using this software in any fashion, you are agreeing to be bound by
9 | * the terms of this license.
10 | * You must not remove this notice, or any other, from this software.
11 | */
12 |
13 | public interface IPersistentVector extends Associative, Sequential, IPersistentStack, Reversible, Indexed{
14 | int length();
15 |
16 | IPersistentVector assocN(int i, Object val);
17 |
18 | IPersistentVector cons(Object o);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/IProxy.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Feb 27, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | public interface IProxy{
16 |
17 | public void __initClojureFnMappings(IPersistentMap m);
18 | public void __updateClojureFnMappings(IPersistentMap m);
19 | public IPersistentMap __getClojureFnMappings();
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/ITransientMap.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Jul 17, 2009 */
12 |
13 | package clojure.lang;
14 |
15 | public interface ITransientMap extends ITransientAssociative, Counted{
16 |
17 | ITransientMap assoc(Object key, Object val);
18 |
19 | ITransientMap without(Object key);
20 |
21 | IPersistentMap persistent();
22 | }
23 |
--------------------------------------------------------------------------------
/src/clj/clojure/uuid.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.uuid)
10 |
11 | (defn- default-uuid-reader [form]
12 | {:pre [(string? form)]}
13 | (java.util.UUID/fromString form))
14 |
15 | (defmethod print-method java.util.UUID [uuid ^java.io.Writer w]
16 | (.write w (str "#uuid \"" (str uuid) "\"")))
17 |
18 | (defmethod print-dup java.util.UUID [o w]
19 | (print-method o w))
20 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Sorted.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /* rich Apr 15, 2008 */
12 |
13 | package clojure.lang;
14 |
15 | import java.util.Comparator;
16 |
17 | public interface Sorted{
18 | Comparator comparator();
19 |
20 | Object entryKey(Object entry);
21 |
22 | ISeq seq(boolean ascending);
23 |
24 | ISeq seqFrom(Object key, boolean ascending);
25 | }
26 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 | Clojure language implementation.
14 |
15 |
The clojure.lang package holds the implementation for Clojure.
16 | The only class considered part of the public API is
17 | {@link clojure.lang.IFn}. All other classes should be considered
18 | implementation details.
The clojure.java.api package provides a minimal interface to bootstrap
16 | Clojure access from other JVM languages. It does this by providing:
17 |
18 |
19 |
20 |
The ability to use Clojure's namespaces to locate an arbitrary
21 | var, returning the
22 | var's clojure.lang.IFn interface.
23 |
A convenience method read for reading data using
24 | Clojure's edn reader
25 |
26 |
27 |
IFns provide complete access to
28 | Clojure's APIs.
29 | You can also access any other library written in Clojure, after adding
30 | either its source or compiled form to the classpath.
31 |
32 |
The public Java API for Clojure consists of the following classes
33 | and interfaces:
34 |
35 |
36 |
37 |
clojure.java.api.Clojure
38 |
clojure.lang.IFn
39 |
40 |
41 |
All other Java classes should be treated as implementation details,
42 | and applications should avoid relying on them.
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/src/jvm/clojure/lang/Repeat.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | package clojure.lang;
12 |
13 | /* Alex Miller, Dec 5, 2014 */
14 |
15 | public class Repeat extends ASeq implements IReduce {
16 |
17 | private static final long INFINITE = -1;
18 |
19 | private final long count; // always INFINITE or >0
20 | private final Object val;
21 | private volatile ISeq _next; // cached
22 |
23 | private Repeat(long count, Object val){
24 | this.count = count;
25 | this.val = val;
26 | }
27 |
28 | private Repeat(IPersistentMap meta, long count, Object val){
29 | super(meta);
30 | this.count = count;
31 | this.val = val;
32 | }
33 |
34 | public static Repeat create(Object val){
35 | return new Repeat(INFINITE, val);
36 | }
37 |
38 | public static ISeq create(long count, Object val){
39 | if(count <= 0)
40 | return PersistentList.EMPTY;
41 | return new Repeat(count, val);
42 | }
43 |
44 | public Object first(){
45 | return val;
46 | }
47 |
48 | public ISeq next() {
49 | if(_next == null) {
50 | if(count > 1)
51 | _next = new Repeat(count - 1, val);
52 | else if(count == INFINITE)
53 | _next = this;
54 | }
55 | return _next;
56 | }
57 |
58 | public Repeat withMeta(IPersistentMap meta){
59 | return new Repeat(meta, count, val);
60 | }
61 |
62 | public Object reduce(IFn f){
63 | Object ret = val;
64 | if(count == INFINITE) {
65 | while(true){
66 | ret = f.invoke(ret, val);
67 | if(RT.isReduced(ret))
68 | return ((IDeref)ret).deref();
69 | }
70 | } else {
71 | for(long i=1; i
2 |
31 |
32 | Provides some useful class and method adapters. The preferred way of using
33 | these adapters is by chaining them together and to custom adapters (instead of
34 | inheriting from them). Indeed this approach provides more combination
35 | possibilities than inheritance. For instance, suppose you want to implement an
36 | adapter MyAdapter than needs sorted local variables and intermediate stack map
37 | frame values taking into account the local variables sort. By using inheritance,
38 | this would require MyAdapter to extend AnalyzerAdapter, itself extending
39 | LocalVariablesSorter. But AnalyzerAdapter is not a subclass of
40 | LocalVariablesSorter, so this is not possible. On the contrary, by using
41 | delegation, you can make LocalVariablesSorter delegate to AnalyzerAdapter,
42 | itself delegating to MyAdapter. In this case AnalyzerAdapter computes
43 | intermediate frames based on the output of LocalVariablesSorter, and MyAdapter
44 | can add new locals by calling the newLocal method on LocalVariablesSorter, and
45 | can get the stack map frame state before each instruction by reading the locals
46 | and stack fields in AnalyzerAdapter (this requires references from MyAdapter
47 | back to LocalVariablesSorter and AnalyzerAdapter).
48 |
--------------------------------------------------------------------------------