aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkripken <alonzakai@gmail.com>2011-06-23 19:00:27 -0700
committerkripken <alonzakai@gmail.com>2011-06-23 19:00:27 -0700
commitc1c1cbbef0be6e0094663adf9466af142bad1af3 (patch)
treeb06163396404cff4abd20ac70c273522c4797597
parent5aec040f3f5f95ee8c5e29cac578bdd331a0e3d5 (diff)
parent9d0ea81c35d7194d3a36c9ed4012b073d8b33ea5 (diff)
Merge pull request #27 from max99x/master
Python fixes: demo polish and module loading
-rw-r--r--AUTHORS2
-rw-r--r--demos/python.html11
-rw-r--r--src/library.js20
3 files changed, 25 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index 24757d07..c897aae1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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('<', '&lt;', '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