diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | demos/python.html | 11 | ||||
-rw-r--r-- | src/library.js | 20 |
3 files changed, 25 insertions, 8 deletions
@@ -3,4 +3,4 @@ under the licensing terms detailed in LICENSE. * Alon Zakai <alonzakai@gmail.com> (copyright owned by Mozilla Foundation) * Tim Dawborn <tim.dawborn@gmail.com> - +* Max Shawabkeh <max99x@gmail.com> diff --git a/demos/python.html b/demos/python.html index f49dc910..a31a0450 100644 --- a/demos/python.html +++ b/demos/python.html @@ -49,7 +49,7 @@ if (force) { var element = document.getElementById('output'); - element.innerHTML = text; + element.value = text; } } @@ -67,14 +67,14 @@ if (e === 'halting, since this is the first run') { return; } - element.innerHTML = 'JS crash: |<b>' + e + '</b>|. Please let us know about this problem!<hr>' + element.innerHTML; + element.value = 'JS crash:\n\n' + e + '\n\nPlease let us know about this problem!\n' + element.value; return; } if (printed) { - element.innerHTML = lines.map(function(line) { return line.replace('<', '<', 'g') }).join('<br>') + '<hr>' + element.innerHTML; + element.value = lines.join('\n') + element.value; } else { - element.innerHTML = '<small><i>(no output)</i></small><hr>' + element.innerHTML; + element.value = '\n(no output)\n-------------\n' + element.value; } } @@ -127,7 +127,6 @@ print 'This is Python {} on {}'.format(sys.version, sys.platform) </div> </form> <hr> - <div id="output" style="font-family: Courier New,Courier,monospace;"></div> + <textarea id="output" style="font-family: monospace; width: 80%" rows="10" readonly></textarea> </body> </html> - diff --git a/src/library.js b/src/library.js index 704ba8a5..fe3f082e 100644 --- a/src/library.js +++ b/src/library.js @@ -368,6 +368,11 @@ var Library = { }, __01fopen64_: 'fopen', + fdopen: function(descriptor, mode) { + // TODO: Check whether mode is acceptable for the current stream. + return descriptor; + }, + rewind__deps: ['$STDIO'], rewind: function(stream) { var info = STDIO.streams[stream]; @@ -388,6 +393,7 @@ var Library = { return 0; }, __01fseeko64_: 'fseek', + __01lseek64_: 'fseek', ftell__deps: ['$STDIO'], ftell: function(stream) { @@ -511,6 +517,13 @@ var Library = { } }, + __01open64___deps: ['open'], + __01open64_: function(filename, mode, flags) { + // open(), but with flags and mode switched. + // TODO: Verify why this happens at all. + return _open(filename, flags, mode); + }, + close: function(stream) { return 0; }, @@ -1211,6 +1224,11 @@ var Library = { return 0; // NULL }, + unlink: function(filename) { + // TODO: Actually implement. + return 0; + }, + // time.h time: function(ptr) { @@ -1259,7 +1277,7 @@ var Library = { // stat.h __01stat64_: function() { return -1 }, - __01fstat64_: function() { return -1 }, + __01fstat64_: 'fstat', // locale.h |