aboutsummaryrefslogtreecommitdiff
path: root/clojurescript/repl
diff options
context:
space:
mode:
Diffstat (limited to 'clojurescript/repl')
-rw-r--r--clojurescript/repl/blank.gifbin48 -> 0 bytes
-rw-r--r--clojurescript/repl/clojure-logo-anim-03.gifbin4919 -> 0 bytes
-rw-r--r--clojurescript/repl/dots.pngbin437 -> 0 bytes
-rw-r--r--clojurescript/repl/repl.cljs91
-rw-r--r--clojurescript/repl/repl.html60
-rw-r--r--clojurescript/repl/repl.js88
6 files changed, 0 insertions, 239 deletions
diff --git a/clojurescript/repl/blank.gif b/clojurescript/repl/blank.gif
deleted file mode 100644
index 7dd151aa..00000000
--- a/clojurescript/repl/blank.gif
+++ /dev/null
Binary files differ
diff --git a/clojurescript/repl/clojure-logo-anim-03.gif b/clojurescript/repl/clojure-logo-anim-03.gif
deleted file mode 100644
index 47ceca66..00000000
--- a/clojurescript/repl/clojure-logo-anim-03.gif
+++ /dev/null
Binary files differ
diff --git a/clojurescript/repl/dots.png b/clojurescript/repl/dots.png
deleted file mode 100644
index 545dbbf7..00000000
--- a/clojurescript/repl/dots.png
+++ /dev/null
Binary files differ
diff --git a/clojurescript/repl/repl.cljs b/clojurescript/repl/repl.cljs
deleted file mode 100644
index ce6eb450..00000000
--- a/clojurescript/repl/repl.cljs
+++ /dev/null
@@ -1,91 +0,0 @@
-(ns jsrepl)
-
-(def append-dom)
-
-(defn dom [o]
- (if (coll? o)
- (let [[tag attrs & body] o]
- (if (keyword? tag)
- (let [elem (.createElement document (name tag))]
- (when (map? attrs)
- (doseq [[k v] attrs]
- (when v (.setAttribute elem (name k) v))))
- [(append-dom elem (if (map? attrs) body (cons attrs body)))])
- (mapcat dom o)))
- (when o
- [(.createTextNode document (str o))])))
-
-(defn append-dom [parent v]
- (doseq [i (dom v)]
- (.appendChild parent i))
- parent)
-
-(def elems)
-(def lastval)
-(def *print-class* nil)
-
-(defn repl-print [text]
- (let [log (:log elems)]
- (doseq [line (.split text #"\n")]
- (append-dom log
- [:div {:class (str "cg "
- (when *print-class*
- (str " " *print-class*)))}
- line]))
- (set! (.scrollTop log) (.scrollHeight log))))
-
-(defn postexpr []
- (append-dom (:log elems)
- [:table
- [:tbody
- [:tr
- [:td {:class "cg"} "user=> "]
- [:td (-> :input elems .value (.replace #"\n$" ""))]]]])
- (set! (-> :scripts elems .innerHTML) "")
- (set! (-> :input elems .value) ""))
-
-(defmacro print-with-class [c m]
- `(binding [*print-class* ~c]
- (println ~m)))
-
-(defn show-state [url]
- (set! (-> :status elems .src) url))
-
-(defn state [status msg]
- (cond
- (= status "incomplete") (show-state "dots.png")
- (= status "done") (prn lastval)
- (= status "error") (do
- (postexpr)
- (show-state "blank.gif")
- (print-with-class "err" msg))
- (= status "compiled") (do
- (postexpr)
- (setTimeout #(show-state "blank.gif") 0))))
-
-(defn err [e]
- (print-with-class "err" e)
- (set! *e e))
-
-(set! *print-length* 103)
-
-(set! (.onload window) (fn []
- ; no refs yet, so just re-def
- (set! elems (into {} (for [n '(log input status scripts)]
- [(keyword n) (.getElementById document (str n))])))
-
- (set! (.print window) repl-print)
-
- (set! (.onkeypress (:input elems))
- (fn [e]
- (let [e (or e event)]
- (when (== (.keyCode e) 13)
- (set! (-> :status elems .src) "clojure-logo-anim-03.gif")
- (append-dom (:scripts elems)
- [:script {:src (str "http://clojurescript.n01se.net:8081/?"
- (-> :input elems .value escape
- (.replace #"\+" "%2b")))}])))))
-
- (println "ClojureScript")
-
- (.focus (:input elems))))
diff --git a/clojurescript/repl/repl.html b/clojurescript/repl/repl.html
deleted file mode 100644
index 1a3a6285..00000000
--- a/clojurescript/repl/repl.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <head>
- <title>ClojureScript REPL</title>
- <style type="text/css">
- body {
- font-family: Monaco,monospace;
- font-size: 10pt;
- }
- .pad {
- height: 20em;
- }
- #log {
- height: 20em;
- overflow: auto;
- white-space: pre-wrap;
- }
- #log table {
- border-collapse: collapse;
- }
- #log td {
- vertical-align: top;
- padding: 0;
- }
- .ns {
- float: left;
- }
- .cg {
- color: #00b;
- }
- .err {
- color: #b00;
- }
- textarea#input {
- padding: 0;
- margin: 0;
- border: none;
- width: 90%;
- height: 6em;
- background: #f3f3f3;
- }
- </style>
- <script type="text/javascript" src="../rt.js"></script>
- <script type="text/javascript" src="../core.js"></script>
- <script type="text/javascript" src="repl.js"></script>
- </head>
- <body>
- <div id="log">
- <div class="pad"></div>
- </div>
- <div class="ns cg">
- user=&gt;&nbsp;<br />
- <img id="status" src="blank.gif">
- </div>
- <textarea id="input"></textarea>
- <div id="scripts"></div>
- </body>
-</html>
diff --git a/clojurescript/repl/repl.js b/clojurescript/repl/repl.js
deleted file mode 100644
index 11f83d94..00000000
--- a/clojurescript/repl/repl.js
+++ /dev/null
@@ -1,88 +0,0 @@
-(function(){
-return (clojure.core.in_ns.apply(null,[clojure.core.symbol("jsrepl")]),
-clojure.core.refer.apply(null,[clojure.core.symbol("clojure.core")]))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"append_dom",null))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"dom",(function(o_1){
-var sq__3428_7,vec__15_2,body_5,attrs_4,k_9,v_10,tag_3,vec__16_8,elem_6;
-return (((clojure.core.coll_QMARK_.apply(null,[o_1]))?(((vec__15_2=o_1),
-(tag_3=clojure.core.nth.apply(null,[vec__15_2,(0),null])),
-(attrs_4=clojure.core.nth.apply(null,[vec__15_2,(1),null])),
-(body_5=clojure.core.nthrest.apply(null,[vec__15_2,(2)])),
-((clojure.core.keyword_QMARK_.apply(null,[tag_3]))?(((elem_6=(clojure.JS.resolveVar("document",jsrepl)).createElement(clojure.core.name.apply(null,[tag_3]))),
-((clojure.core.map_QMARK_.apply(null,[attrs_4]))?(((function(){var _rtn,_cnt;(sq__3428_7=clojure.core.seq.apply(null,[attrs_4]));do{_cnt=0;
-_rtn=((sq__3428_7)?(((vec__16_8=clojure.core.first.apply(null,[sq__3428_7])),
-(k_9=clojure.core.nth.apply(null,[vec__16_8,(0),null])),
-(v_10=clojure.core.nth.apply(null,[vec__16_8,(1),null])),
-((true)?(((true)?(((v_10)?((elem_6).setAttribute(clojure.core.name.apply(null,[k_9]),v_10)):(null))):(null)),
-(_cnt=1,_rtn=[clojure.core.rest.apply(null,[sq__3428_7])],sq__3428_7=_rtn[0])):(null)))):(null))}while(_cnt);return _rtn;})())):(null)),
-clojure.JS.lit_vector([jsrepl.append_dom.apply(null,[elem_6,((clojure.core.map_QMARK_.apply(null,[attrs_4]))?(body_5):(clojure.core.cons.apply(null,[attrs_4,body_5])))])]))):(clojure.core.mapcat.apply(null,[jsrepl.dom,o_1]))))):(((o_1)?(clojure.JS.lit_vector([(clojure.JS.resolveVar("document",jsrepl)).createTextNode(clojure.core.str.apply(null,[o_1]))])):(null)))))})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"append_dom",(function(parent_1,v_2){
-var sq__3428_3,i_4;
-return (((function(){var _rtn,_cnt;(sq__3428_3=clojure.core.seq.apply(null,[jsrepl.dom.apply(null,[v_2])]));do{_cnt=0;
-_rtn=((sq__3428_3)?(((i_4=clojure.core.first.apply(null,[sq__3428_3])),
-((true)?(((true)?((parent_1).appendChild(i_4)):(null)),
-(_cnt=1,_rtn=[clojure.core.rest.apply(null,[sq__3428_3])],sq__3428_3=_rtn[0])):(null)))):(null))}while(_cnt);return _rtn;})()),
-parent_1)})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"elems",null))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"lastval",null))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"_STAR_print_class_STAR_",null))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"repl_print",(function(text_1){
-var log_2,sq__3428_3,line_4;
-return (((log_2=clojure.core.keyword("","log").apply(null,[jsrepl.elems])),
-((function(){var _rtn,_cnt;(sq__3428_3=clojure.core.seq.apply(null,[(text_1).split((/\n/))]));do{_cnt=0;
-_rtn=((sq__3428_3)?(((line_4=clojure.core.first.apply(null,[sq__3428_3])),
-((true)?(((true)?(jsrepl.append_dom.apply(null,[log_2,clojure.JS.lit_vector([clojure.core.keyword("","div"),clojure.core.hash_map(clojure.core.keyword("","class"),clojure.core.str.apply(null,["cg ",((jsrepl._STAR_print_class_STAR_)?(clojure.core.str.apply(null,[" ",jsrepl._STAR_print_class_STAR_])):(null))])),line_4])])):(null)),
-(_cnt=1,_rtn=[clojure.core.rest.apply(null,[sq__3428_3])],sq__3428_3=_rtn[0])):(null)))):(null))}while(_cnt);return _rtn;})()),
-(log_2.scrollTop=clojure.JS.getOrRun(log_2,"scrollHeight"))))})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"postexpr",(function(){
-return (jsrepl.append_dom.apply(null,[clojure.core.keyword("","log").apply(null,[jsrepl.elems]),clojure.JS.lit_vector([clojure.core.keyword("","table"),clojure.JS.lit_vector([clojure.core.keyword("","tbody"),clojure.JS.lit_vector([clojure.core.keyword("","tr"),clojure.JS.lit_vector([clojure.core.keyword("","td"),clojure.core.hash_map(clojure.core.keyword("","class"),"cg"),"user=> "]),clojure.JS.lit_vector([clojure.core.keyword("","td"),(clojure.JS.getOrRun(jsrepl.elems.apply(null,[clojure.core.keyword("","input")]),"value")).replace((/\n$/),"")])])])])]),
-(jsrepl.elems.apply(null,[clojure.core.keyword("","scripts")]).innerHTML=""),
-(jsrepl.elems.apply(null,[clojure.core.keyword("","input")]).value=""))})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"show_state",(function(url_1){
-return ((jsrepl.elems.apply(null,[clojure.core.keyword("","status")]).src=url_1))})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"state",(function(status_1,msg_2){
-return (((clojure.lang.Util.equal(status_1,"incomplete"))?(jsrepl.show_state.apply(null,["dots.png"])):(((clojure.lang.Util.equal(status_1,"done"))?(clojure.core.prn.apply(null,[jsrepl.lastval])):(((clojure.lang.Util.equal(status_1,"error"))?(jsrepl.postexpr.apply(null,[]),
-jsrepl.show_state.apply(null,["blank.gif"]),
-clojure.lang.Var.pushThreadBindings(clojure.core.hash_map.apply(null,[jsrepl._var__STAR_print_class_STAR_,"err"])),
-(function(){try{var _rtn=(clojure.core.println.apply(null,[msg_2]))}
-finally{clojure.lang.Var.popThreadBindings()}return _rtn})()):(((clojure.lang.Util.equal(status_1,"compiled"))?(jsrepl.postexpr.apply(null,[]),
-clojure.JS.resolveVar("setTimeout",jsrepl).apply(null,[(function(){
-return (jsrepl.show_state.apply(null,["blank.gif"]))}),(0)])):(null)))))))))})))}).apply(null,[]);
-(function(){
-return (clojure.JS.def(jsrepl,"err",(function(e_1){
-return (clojure.lang.Var.pushThreadBindings(clojure.core.hash_map.apply(null,[jsrepl._var__STAR_print_class_STAR_,"err"])),
-(function(){
-return ((function(){try{var _rtn=(clojure.core.println.apply(null,[e_1]))}
-finally{clojure.lang.Var.popThreadBindings()}return _rtn})())}).apply(null,[]),
-clojure.core._var__STAR_e.set(e_1))})))}).apply(null,[]);
-(function(){
-return (clojure.core._var__STAR_print_length_STAR_.set((103)))}).apply(null,[]);
-(function(){
-return ((clojure.JS.resolveVar("window",jsrepl).onload=(function(){
-var iter__3875_1;
-return (jsrepl._var_elems.set(clojure.core.into.apply(null,[clojure.lang.PersistentHashMap.EMPTY,((iter__3875_1=(function(s__87_1){
-var n_2,iter__86_0=arguments.callee;
-return (((clojure.core.seq.apply(null,[s__87_1]))?(((n_2=clojure.core.first.apply(null,[s__87_1])),
-((true)?((new clojure.lang.LazyCons((function(G__89_1){switch(arguments.length){
-case 0:return (clojure.JS.lit_vector([clojure.core.keyword.apply(null,[n_2]),(clojure.JS.resolveVar("document",jsrepl)).getElementById(clojure.core.str.apply(null,[n_2]))]))}
-return (iter__86_0.apply(null,[clojure.core.rest.apply(null,[s__87_1])]))})))):(null)))):(null)))})),
-iter__3875_1.apply(null,[clojure.JS.lit_list([clojure.core.symbol("log"),clojure.core.symbol("input"),clojure.core.symbol("status"),clojure.core.symbol("scripts")])]))])),
-(clojure.JS.resolveVar("window",jsrepl).print=jsrepl.repl_print),
-(clojure.core.keyword("","input").apply(null,[jsrepl.elems]).onkeypress=(function(e_1){
-var or__2827_2,e_2;
-return (((e_2=((or__2827_2=e_1),
-((or__2827_2)?(or__2827_2):(clojure.JS.resolveVar("event",jsrepl))))),
-((clojure.lang.Numbers.equiv(clojure.JS.getOrRun(e_2,"keyCode"),(13)))?((jsrepl.elems.apply(null,[clojure.core.keyword("","status")]).src="clojure-logo-anim-03.gif"),
-jsrepl.append_dom.apply(null,[clojure.core.keyword("","scripts").apply(null,[jsrepl.elems]),clojure.JS.lit_vector([clojure.core.keyword("","script"),clojure.core.hash_map(clojure.core.keyword("","src"),clojure.core.str.apply(null,["http://clojurescript.n01se.net:8081/?",(clojure.JS.resolveVar("escape",jsrepl).apply(null,[clojure.JS.getOrRun(jsrepl.elems.apply(null,[clojure.core.keyword("","input")]),"value")])).replace((/\+/),"%2b")]))])])):(null))))})),
-clojure.core.println.apply(null,["ClojureScript"]),
-clojure.JS.getOrRun(clojure.core.keyword("","input").apply(null,[jsrepl.elems]),"focus"))})))}).apply(null,[]);