summaryrefslogtreecommitdiff
path: root/gnucapjs/gnucap-io.js
diff options
context:
space:
mode:
Diffstat (limited to 'gnucapjs/gnucap-io.js')
-rwxr-xr-xgnucapjs/gnucap-io.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnucapjs/gnucap-io.js b/gnucapjs/gnucap-io.js
new file mode 100755
index 0000000..defb5d9
--- /dev/null
+++ b/gnucapjs/gnucap-io.js
@@ -0,0 +1,51 @@
+
+
+// var statusElement = document.getElementById('gnucap_scope_display_div');
+// var progressElement = document.getElementById('progress');
+// var spinnerElement = document.getElementById('spinner');
+ var spicenetlist="";
+
+ Module = {
+ preRun: [function(){
+ FS.writeFile("/temp",spicenetlist);
+ }],
+ postRun:[function(){
+ }],
+ arguments:["-b","/temp"],
+ print:function(text) {
+ text = Array.prototype.slice.call(arguments).join(' ');
+ postMessage(text+'\n');
+ },
+ printErr: function(text) {
+ text = Array.prototype.slice.call(arguments).join(' ');
+ if (0) { // XXX disabled for safety typeof dump == 'function') {
+ dump(text + '\n'); // fast, straight to the real console
+ } else {
+ console.log(text);
+ }
+
+ },
+// canvas: document.getElementById('canvas'),
+ setStatus: function(text) {
+ if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
+ if (text === Module.setStatus.text) return;
+ var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
+ var now = Date.now();
+ if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon
+ if (m) {
+ text = m[1];
+ } else {
+//code is finished
+ if (!text){
+ postMessage("SIMULATION COMPLETED");
+ }
+ }
+ },
+ };
+ self.addEventListener("message", function(e) {
+ spicenetlist=e.data
+ // the passed-in data is available via e.data
+ importScripts("gnucap-ugly.js");
+ }, false);
+ Module.TOTAL_MEMORY=67108864;
+ Module.setStatus('Downloading...');