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

  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright (c) 2010, 2011 The Native Client Authors. All rights reserved.
  5. Use of this source code is governed by a BSD-style license that can be
  6. found in the LICENSE file.
  7. -->
  8. <head>
  9. <title>Tcl in Nacl</title>
  10. <script type="text/javascript">
  11. tclModule = null; // Global application object.
  12. output = null;
  13. function loaded () {
  14. tclModule = document.getElementById('tcl');
  15. output = document.getElementById("output");
  16. }
  17. function moduleDidLoad() {
  18. tclModule = document.getElementById('tcl');
  19. }
  20. function doeval() {
  21. try {
  22. output.appendChild(document.createTextNode(tclModule.eval(document.the_form.input_id.value)));
  23. output.appendChild(document.createElement("br"));
  24. } catch(e) {
  25. alert("ERROR: " + e.message);
  26. }
  27. }
  28. </script>
  29. </head>
  30. <body onload="loaded()">
  31.  
  32. <h1>Native Client Tcl Module</h1>
  33. <p>
  34. <form name="the_form" action="" method="get">
  35. <textarea id="input_id" cols=80 name="inputbox">list a b c</textarea>
  36. <br>
  37. <input type="submit" value="Call eval()" onclick="doeval(); return false;">
  38. </form>
  39. <h2>Output:</h2>
  40. <div id="output"></div>
  41. <!-- Load the published .nexe. This includes the 'nacl' attribute which
  42. shows how to load multi-architecture modules. Each entry in the "nexes"
  43. object in the .nmf manifest file is a key-value pair: the key is the runtime
  44. ('x86-32', 'x86-64', etc.); the value is a URL for the desired NaCl module.
  45. To load the debug versions of your .nexes, set the 'nacl' attribute to the
  46. _dbg.nmf version of the manifest file.
  47. -->
  48. <embed name="nacl_module"
  49. id="tcl"
  50. width=0 height=0
  51. nacl="tcl.nmf"
  52. type="application/x-nacl"
  53. onload="moduleDidLoad();" />
  54. </p>
  55. </body>
  56. </html>