diff --git a/whalesong/repl-prototype/htdocs/index.html b/whalesong/repl-prototype/htdocs/index.html index 6d7fac6..531347a 100644 --- a/whalesong/repl-prototype/htdocs/index.html +++ b/whalesong/repl-prototype/htdocs/index.html @@ -3,6 +3,7 @@
+ diff --git a/whalesong/repl-prototype/htdocs/repl.js b/whalesong/repl-prototype/htdocs/repl.js index 71606f3..7debf47 100644 --- a/whalesong/repl-prototype/htdocs/repl.js +++ b/whalesong/repl-prototype/htdocs/repl.js @@ -1,33 +1,39 @@ -$(document).ready(function() { +jQuery(document).ready(function() { "use strict"; if (! console.log) { console.log = function() { }; } - var repl = $("#repl"); - var output = $("#output"); - var breakButton = $("#break"); - var resetButton = $("#reset"); + var repl = jQuery("#repl"); + var output = jQuery("#output"); + var breakButton = jQuery("#break"); + var resetButton = jQuery("#reset"); breakButton.hide(); breakButton.click(function() { interruptEvaluation(); }); resetButton.click(function() { output.empty(); setupMachine(); }); + // The machine. var M; var sendOutputToBottom = function() { output.get(0).scrollTop = output.get(0).scrollHeight; }; + + var xhr = new easyXDM.Rpc( + { remote: 'rpc.html' }, + { remote: { replCompile: {} } }); + var setupMachine = function() { M = plt.runtime.currentMachine; M.reset(); // We configure output to send it to the "output" DOM node. M.params.currentDisplayer = function(MACHINE, domNode) { - $(domNode).appendTo(output); + jQuery(domNode).appendTo(output); sendOutputToBottom(); }; M.params.currentErrorDisplayer = function(MACHINE, domNode) { - $(domNode).css("color", "red").appendTo(output); + jQuery(domNode).css("color", "red").appendTo(output); sendOutputToBottom(); }; @@ -48,9 +54,6 @@ $(document).ready(function() { }, function(M, err) { // Nothing should work if we can't get this to work. - console.log(M); - console.log(err); - console.log(err.stack); alert("uh oh!: language could not be loaded."); }); }; @@ -64,7 +67,7 @@ $(document).ready(function() { repl.keypress(function(e) { if (e.which == 13 && !repl.attr('disabled')) { var src = repl.val(); - $(this).val(""); + jQuery(this).val(""); repl.attr('disabled', 'true'); repl.val("... evaluating..."); breakButton.show(); @@ -78,9 +81,6 @@ $(document).ready(function() { }; - setupMachine(); - - // CPS'ed for-each. var forEachK = function(elts, f, after) { var n = elts.length; @@ -98,11 +98,11 @@ $(document).ready(function() { // writeErrorMessage: string -> void // Write out an error message. var writeErrorMessage = function(msg) { - $("") + jQuery("") .text(''+msg) .css("color", "red") .appendTo(output); - $("