Permalink
Browse files

Init commit for gambit-in-nacl

  • Loading branch information...
0 parents commit 70cf1d69eeeb499632cb5be268cd9483fe91fe49 @wsxiaoys committed Feb 3, 2014
Showing with 15,564 additions and 0 deletions.
  1. +17 −0 background.js
  2. +30 −0 gambc.html
  3. +62 −0 gambc.js
  4. +11 −0 gambc.nmf
  5. BIN gambc_x86_32.nexe
  6. BIN gambc_x86_64.nexe
  7. +14,932 −0 hterm.concat.js
  8. BIN icon_128.png
  9. BIN icon_16.png
  10. BIN icon_48.png
  11. +33 −0 index.html
  12. +19 −0 manifest.json
  13. +407 −0 naclterm.js
  14. +53 −0 scm/pi.scm
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2013 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.
+ */
+
+'use strict';
+
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.app.window.create('gambc.html', {
+ 'id': 'main',
+ 'bounds': {
+ 'width': 800,
+ 'height': 800
+ }
+ });
+});
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Gambit scheme Interpreter</title>
+ <script type="text/javascript" src="hterm.concat.js"></script>
+ <script type="text/javascript" src="naclterm.js"></script>
+ <script type="text/javascript" src="gambc.js"></script>
+
+ <style type="text/css">
+ body {
+ position: absolute;
+ padding: 0;
+ margin: 0;
+ height: 100%;
+ width: 100%;
+ overflow: hidden;
+ }
+
+ #terminal {
+ display: block;
+ position: static;
+ width: 100%;
+ height: 100%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="terminal"></div>
+ </body>
+</html>
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013 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.
+ */
+
+NaClTerm.prefix = 'gambc'
+NaClTerm.nmf = 'gambc.nmf'
+
+function log(message) {
+ document.getElementById('log').textContent = message;
+}
+
+function fsErrorHandler(error) {
+ log("Filesystem error: "+ error);
+}
+
+function uploadFile(file) {
+ fs.root.getFile(file.name, {create: true, exclusive: true},
+ function(fileEntry) {
+ fileEntry.createWriter(function(fileWriter) {
+ // Note: write() can take a File or Blob object.
+ fileWriter.write(file);
+ log("File uploaded!\n");
+ }, fsErrorHandler);
+ }, fsErrorHandler);
+}
+
+function uploadFiles(evt) {
+ var files = this.files;
+ for (var i = 0, file; file = files[i]; ++i) {
+ uploadFile(file)
+ }
+}
+
+function onInitFS(fs) {
+ var upload = document.getElementById('upload');
+ if (upload !== null) {
+ upload.addEventListener('change', uploadFiles, false);
+ window.fs = fs
+ }
+ NaClTerm.init();
+}
+
+function onInit() {
+ navigator.webkitPersistentStorage.requestQuota(1024 * 1024,
+ function(bytes) {
+ window.webkitRequestFileSystem(window.PERSISTENT, bytes, onInitFS)
+ },
+ function() {
+ log("Failed to allocate space!\n");
+ // Start the terminal even if FS failed to init.
+ NaClTerm.init();
+ }
+ );
+}
+
+window.onload = function() {
+ lib.init(function() {
+ onInit();
+ });
+};
@@ -0,0 +1,11 @@
+{
+ "files": {},
+ "program": {
+ "x86-64": {
+ "url": "gambc_x86_64.nexe"
+ },
+ "x86-32": {
+ "url": "gambc_x86_32.nexe"
+ }
+ }
+}
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 70cf1d6

Please sign in to comment.