diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-07 17:54:01 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-07 17:54:01 -0700 |
commit | 42a6216329d5dee646003f441d4908dd86b804a8 (patch) | |
tree | 74df15636bee42e9434885b6ad0710f0b931686e | |
parent | 09c67774af1379b51a1ac802a25c07f00a45cf0f (diff) |
fix stdio streams and printing of chars; fixes freetype
-rw-r--r-- | src/library.js | 6 | ||||
-rw-r--r-- | system/include/libc/stdio.h | 2 | ||||
-rw-r--r-- | tests/files.cpp | 2 | ||||
-rw-r--r-- | tests/runner.py | 2 |
4 files changed, 5 insertions, 7 deletions
diff --git a/src/library.js b/src/library.js index c3536e63..a8d29ff0 100644 --- a/src/library.js +++ b/src/library.js @@ -397,11 +397,7 @@ LibraryManager.library = { FS.streams[_stdin] = FS.streams[1]; FS.streams[_stdout] = FS.streams[2]; FS.streams[_stderr] = FS.streams[3]; - __impure_ptr = allocate(5, "void*", ALLOC_STATIC); - var impure = getValue(__impure_ptr, "void*"); - setValue(impure + {{{ QUANTUM_SIZE }}}, _stdin, "void*"); - setValue(impure + {{{ QUANTUM_SIZE }}}*2, _stdout, "void*"); - setValue(impure + {{{ QUANTUM_SIZE }}}*3, _stderr, "void*"); + __impure_ptr = allocate([ allocate([0, 0, 0, 0, _stdin, 0, 0, 0, _stdout, 0, 0, 0, _stderr, 0, 0, 0], 'void*', ALLOC_STATIC) ], 'void*', ALLOC_STATIC); // Once initialized, permissions start having effect. FS.ignorePermissions = false; diff --git a/system/include/libc/stdio.h b/system/include/libc/stdio.h index 2912eafa..a92de046 100644 --- a/system/include/libc/stdio.h +++ b/system/include/libc/stdio.h @@ -657,7 +657,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #define fileno(p) __sfileno(p) #endif -#ifndef __CYGWIN__ +#if !defined(__CYGWIN__) && !defined(EMSCRIPTEN) #ifndef lint #define getc(fp) __sgetc_r(_REENT, fp) #define putc(x, fp) __sputc_r(_REENT, x, fp) diff --git a/tests/files.cpp b/tests/files.cpp index 6283c4f1..d692ce67 100644 --- a/tests/files.cpp +++ b/tests/files.cpp @@ -33,6 +33,8 @@ int main() printf("input:%s\n", gets((char*)malloc(1024))); fwrite("texto\n", 1, 6, stdout); fwrite("texte\n", 1, 6, stderr); + putchar('$'); + putc('\n', stdout); // Writing diff --git a/tests/runner.py b/tests/runner.py index 783fe4d6..6566d408 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2407,7 +2407,7 @@ if 'benchmark' not in str(sys.argv): other.close() src = open(path_from_root('tests', 'files.cpp'), 'r').read() - self.do_test(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\ninput:hi there!\ntexto\ntexte\n5 : 10,30,20,11,88\nother=some data.\nseeked=me da.\nseeked=ata.\nseeked=ta.\nfscanfed: 10 - hello\n', + self.do_test(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\ninput:hi there!\ntexto\ntexte\n$\n5 : 10,30,20,11,88\nother=some data.\nseeked=me da.\nseeked=ata.\nseeked=ta.\nfscanfed: 10 - hello\n', post_build=post, extra_emscripten_args=['-H', 'libc/fcntl.h']) def test_folders(self): |