Posted to tcl by colin at Mon Apr 04 03:05:16 GMT 2011view pretty

<!DOCTYPE html>
<html>
  <!--
  Copyright (c) 2010, 2011 The Native Client Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
  -->
<head>
  <title>Tcl in Nacl</title>
  <script type="text/javascript">
  tclModule = null;  // Global application object.
  output = null;
  function loaded () {
           tclModule = document.getElementById('tcl');
           output = document.getElementById("output");
  }
  function moduleDidLoad() {
    tclModule = document.getElementById('tcl');
  }
  function doeval() {
     try {
     output.appendChild(document.createTextNode(tclModule.eval(document.the_form.input_id.value)));
     output.appendChild(document.createElement("br"));
     } catch(e) {
       alert("ERROR: " + e.message);
     }
  }
  </script>
</head>
<body onload="loaded()">

<h1>Native Client Tcl Module</h1>
<p>
  <form name="the_form" action="" method="get">
  <textarea id="input_id" cols=80 name="inputbox">list a b c</textarea>
  <br>
  <input type="submit" value="Call eval()" onclick="doeval(); return false;">
  </form>
  <h2>Output:</h2>
  <div id="output"></div>
  <!-- Load the published .nexe.  This includes the 'nacl' attribute which
  shows how to load multi-architecture modules.  Each entry in the "nexes"
  object in the  .nmf manifest file is a key-value pair: the key is the runtime
  ('x86-32', 'x86-64', etc.); the value is a URL for the desired NaCl module.
  To load the debug versions of your .nexes, set the 'nacl' attribute to the
  _dbg.nmf version of the manifest file.
  -->
  <embed name="nacl_module"
         id="tcl"
         width=0 height=0
         nacl="tcl.nmf"
         type="application/x-nacl"
         onload="moduleDidLoad();" />
</p>
</body>
</html>