<html>
  <head>
    <title>JS JVM</title>
    <script>
		var lident = -1;
      write = function(msg){
      var l = document.getElementById("log");
      var match;
		if (msg.match(/Calling/)){
			lident++;
		}
		if ((match = msg.match(/(\d+): (\w+) (op:\[[^\]]*]) (.*)/))){
			var space3 = "";
			for(var i=0; i<3-(match[1].length); i++){space3 += " " }
			var space1 = "";
			for(var i=0; i<23-(match[1].length + space3.length + match[2].length);i++ ){space1 += " " }
			var space2 = "";
			for(var i=0; i<30-(match[3].length); i++ ){space2 += " " }
			msg = "<span style='color:DarkOrchid '>" + match[1] + "</span>:"+ space3 +"<a style='color:red;' href='http://homepages.inf.ed.ac.uk/kwxm/JVM/" + match[2].toLowerCase().replace(/\d+/,"n") + ".html'>" + match[2] + "</a>" + space1 + htmlentities(match[3]) + space2 +" "+ htmlentities(match[4]) ;
		}else{
			msg=htmlentities(msg);
		}
		if (msg.match(/!! NATIVE !!/)){
			msg = "<span style='color:green'>" + msg + "</span>"
		}
		var spac = ""
		for (var i =0; i<lident; i++){ spac += "    ";}
		if (msg.match(/Returing/)){
			lident--;
		}
      l.innerHTML = l.innerHTML + spac + msg + "\n";

      }
	function panic(msg){
		var l = document.getElementById("log");
		msg = "<div style='background:red; color:white; padding:5px; margin-top:5px;'>" + msg + "</div>";
		l.innerHTML = l.innerHTML + msg;
	}
	function include(filename)
	{
	   document.write('<script type="text/javascript" src="' + filename + 
	                  '"><' + '/script>');
	}
	
	if(!window.DataView){
		include("dataview.js");
	}
    </script>
    <script src="jvm.js" type="text/javascript"></script>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <style>
	body{
		background:#DDE1ED;
			font-family:Arial;
			font-size:12px;
	}
	#background{
		background:#DDE1ED;
	}
	#stick textarea{
		margin-top:20px;
		height:180px;
		width:200px;
		background:#FFCC00;
	}

	.ui-dialog-title{
		padding-left:40px;
	}
  </style>

     </head>
  <body onload="main()">
  <h1>JS JVM</h1>
  Debug:
  <pre id="log"></pre>
  </body>
</html>