diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 19:53:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 19:53:24 -0800 |
commit | 9f00292b7c7fa0cf69b8704c23b092811a9f9cc1 (patch) | |
tree | 8fb3478da53b0b168a0afe657a681a04d24c1d39 | |
parent | 7953c8c6b8911647de68b4f22206650672cbca0a (diff) | |
parent | 78fde14808c0b075bd040d23b1d8cfb349c7cd84 (diff) |
Merge branch 'master' into incoming
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | README.markdown | 2 | ||||
-rw-r--r-- | src/library.js | 6 | ||||
-rw-r--r-- | system/include/libc/stdio.h | 2 | ||||
-rw-r--r-- | tests/files.cpp | 12 | ||||
-rw-r--r-- | tests/runner.py | 2 |
6 files changed, 22 insertions, 3 deletions
@@ -10,3 +10,4 @@ under the licensing terms detailed in LICENSE. * Andreas Bergmeier <andreas.bergmeier@gmx.net> * Ben Schwartz <bens@alum.mit.edu> * David Claughton <dave@eclecticdave.com> +* David Yip <yipdw@member.fsf.org> diff --git a/README.markdown b/README.markdown index eeb50156..dadbf3a4 100644 --- a/README.markdown +++ b/README.markdown @@ -4,7 +4,7 @@ Emscripten Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run). -Links to **demos**, **FAQ**, etc: <https://github.com/kripken/emscripten/wiki> +Links to **demos**, **tutorial**, **FAQ**, etc: <https://github.com/kripken/emscripten/wiki> Main project page: <http://emscripten.org> diff --git a/src/library.js b/src/library.js index 1747155f..a665fc8f 100644 --- a/src/library.js +++ b/src/library.js @@ -3843,6 +3843,12 @@ LibraryManager.library = { return 0; }, + __strtok_state: 0, + strtok__deps: ['__strtok_state', 'strtok_r'], + strtok: function(s, delim) { + return _strtok_r(s, delim, ___strtok_state); + }, + // Translated from newlib; for the original source and licensing, see library_strtok_r.c strtok_r: function(s, delim, lasts) { var skip_leading_delim = 1; diff --git a/system/include/libc/stdio.h b/system/include/libc/stdio.h index fb4501c4..1b0c30f5 100644 --- a/system/include/libc/stdio.h +++ b/system/include/libc/stdio.h @@ -647,7 +647,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) #define __sfileno(p) ((p)->_file) -#ifndef _REENT_SMALL +#if 0 /* XXX Emscripten ndef _REENT_SMALL */ #define feof(p) __sfeof(p) #define ferror(p) __sferror(p) #define clearerr(p) __sclearerr(p) diff --git a/tests/files.cpp b/tests/files.cpp index d692ce67..e1a38421 100644 --- a/tests/files.cpp +++ b/tests/files.cpp @@ -28,6 +28,18 @@ int main() fclose (file); free (buffer); + // Do it again, with a loop on feof + + printf("loop: "); + file = fopen("somefile.binary", "rb"); + assert(file); + while (!feof(file)) { + char c = fgetc(file); + if (c != EOF) printf("%d ", c); + } + fclose (file); + printf("\n"); + // Standard streams printf("input:%s\n", gets((char*)malloc(1024))); diff --git a/tests/runner.py b/tests/runner.py index 3a104609..bb10ca81 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2951,7 +2951,7 @@ at function.:blag other.close() src = open(path_from_root('tests', 'files.cpp'), 'r').read() - self.do_run(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', + self.do_run(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\nloop: 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): |