webruby 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webruby/config.rb +4 -9
  3. data/lib/webruby/rake/files.rake +2 -2
  4. data/modules/emscripten/AUTHORS +9 -1
  5. data/modules/emscripten/CONTRIBUTING.markdown +5 -0
  6. data/modules/emscripten/ChangeLog +435 -0
  7. data/modules/emscripten/cmake/Modules/FindOpenAL.cmake +26 -0
  8. data/modules/emscripten/cmake/Platform/Emscripten.cmake +9 -2
  9. data/modules/emscripten/em++ +0 -2
  10. data/modules/emscripten/emcc +92 -32
  11. data/modules/emscripten/emlink.py +16 -13
  12. data/modules/emscripten/emmake +1 -1
  13. data/modules/emscripten/emrun +918 -0
  14. data/modules/emscripten/emrun.bat +2 -0
  15. data/modules/emscripten/emscripten.py +545 -20
  16. data/modules/emscripten/src/analyzer.js +6 -1
  17. data/modules/emscripten/src/compiler.js +25 -16
  18. data/modules/emscripten/src/emrun_postjs.js +20 -0
  19. data/modules/emscripten/{tests → src}/hello_world.js +0 -0
  20. data/modules/emscripten/src/intertyper.js +45 -16
  21. data/modules/emscripten/src/jsifier.js +78 -48
  22. data/modules/emscripten/src/library.js +381 -96
  23. data/modules/emscripten/src/library_browser.js +50 -53
  24. data/modules/emscripten/src/library_egl.js +66 -24
  25. data/modules/emscripten/src/library_fs.js +122 -90
  26. data/modules/emscripten/src/library_gl.js +739 -353
  27. data/modules/emscripten/src/library_glfw.js +9 -3
  28. data/modules/emscripten/src/library_glut.js +10 -5
  29. data/modules/emscripten/src/library_idbfs.js +14 -14
  30. data/modules/emscripten/src/library_memfs.js +65 -41
  31. data/modules/emscripten/src/library_nodefs.js +61 -9
  32. data/modules/emscripten/src/library_openal.js +4 -4
  33. data/modules/emscripten/src/library_path.js +9 -13
  34. data/modules/emscripten/src/library_sdl.js +301 -64
  35. data/modules/emscripten/src/library_sockfs.js +7 -5
  36. data/modules/emscripten/src/modules.js +62 -22
  37. data/modules/emscripten/src/parseTools.js +135 -102
  38. data/modules/emscripten/src/postamble.js +3 -4
  39. data/modules/emscripten/src/preamble.js +49 -29
  40. data/modules/emscripten/src/proxyClient.js +1 -1
  41. data/modules/emscripten/src/proxyWorker.js +10 -10
  42. data/modules/emscripten/src/relooper/Relooper.cpp +15 -4
  43. data/modules/emscripten/src/runtime.js +32 -8
  44. data/modules/emscripten/src/settings.js +25 -8
  45. data/modules/emscripten/src/shell.html +6 -3
  46. data/modules/emscripten/src/shell.js +13 -11
  47. data/modules/emscripten/src/simd.js +602 -432
  48. data/modules/emscripten/src/struct_info.json +22 -2
  49. data/modules/emscripten/src/utility.js +32 -17
  50. data/modules/emscripten/system/include/SDL/SDL_events.h +1 -0
  51. data/modules/emscripten/system/include/compat/ctype.h +17 -0
  52. data/modules/emscripten/system/include/compat/wchar.h +23 -0
  53. data/modules/emscripten/system/include/compat/wctype.h +23 -0
  54. data/modules/emscripten/system/include/emscripten/emmintrin.h +87 -0
  55. data/modules/emscripten/system/include/emscripten/emscripten.h +30 -4
  56. data/modules/emscripten/system/include/emscripten/vector.h +29 -1
  57. data/modules/emscripten/system/include/emscripten/xmmintrin.h +131 -0
  58. data/modules/emscripten/system/include/libcxx/CREDITS.TXT +9 -1
  59. data/modules/emscripten/system/include/libcxx/__bit_reference +8 -8
  60. data/modules/emscripten/system/include/libcxx/__config +95 -17
  61. data/modules/emscripten/system/include/libcxx/__debug +25 -4
  62. data/modules/emscripten/system/include/libcxx/__functional_03 +7 -7
  63. data/modules/emscripten/system/include/libcxx/__functional_base +169 -9
  64. data/modules/emscripten/system/include/libcxx/__functional_base_03 +1 -1
  65. data/modules/emscripten/system/include/libcxx/__hash_table +25 -25
  66. data/modules/emscripten/system/include/libcxx/__locale +21 -19
  67. data/modules/emscripten/system/include/libcxx/__mutex_base +2 -33
  68. data/modules/emscripten/system/include/libcxx/__split_buffer +9 -9
  69. data/modules/emscripten/system/include/libcxx/__std_stream +14 -0
  70. data/modules/emscripten/system/include/libcxx/__tree +35 -26
  71. data/modules/emscripten/system/include/libcxx/__tuple +15 -15
  72. data/modules/emscripten/system/include/libcxx/__tuple_03 +2 -2
  73. data/modules/emscripten/system/include/libcxx/__undef_min_max +8 -0
  74. data/modules/emscripten/system/include/libcxx/algorithm +121 -110
  75. data/modules/emscripten/system/include/libcxx/array +15 -15
  76. data/modules/emscripten/system/include/libcxx/bitset +4 -4
  77. data/modules/emscripten/system/include/libcxx/chrono +51 -17
  78. data/modules/emscripten/system/include/libcxx/cmath +25 -23
  79. data/modules/emscripten/system/include/libcxx/codecvt +21 -18
  80. data/modules/emscripten/system/include/libcxx/complex +48 -7
  81. data/modules/emscripten/system/include/libcxx/cstddef +1 -1
  82. data/modules/emscripten/system/include/libcxx/cstdio +8 -1
  83. data/modules/emscripten/system/include/libcxx/cstdlib +1 -1
  84. data/modules/emscripten/system/include/libcxx/cwchar +1 -1
  85. data/modules/emscripten/system/include/libcxx/deque +26 -12
  86. data/modules/emscripten/system/include/libcxx/dynarray +311 -0
  87. data/modules/emscripten/system/include/libcxx/exception +4 -4
  88. data/modules/emscripten/system/include/libcxx/ext/__hash +3 -3
  89. data/modules/emscripten/system/include/libcxx/ext/hash_map +19 -15
  90. data/modules/emscripten/system/include/libcxx/ext/hash_set +7 -3
  91. data/modules/emscripten/system/include/libcxx/forward_list +33 -7
  92. data/modules/emscripten/system/include/libcxx/fstream +4 -4
  93. data/modules/emscripten/system/include/libcxx/functional +200 -170
  94. data/modules/emscripten/system/include/libcxx/future +83 -39
  95. data/modules/emscripten/system/include/libcxx/initializer_list +24 -11
  96. data/modules/emscripten/system/include/libcxx/iomanip +147 -0
  97. data/modules/emscripten/system/include/libcxx/ios +24 -16
  98. data/modules/emscripten/system/include/libcxx/iosfwd +19 -19
  99. data/modules/emscripten/system/include/libcxx/istream +13 -8
  100. data/modules/emscripten/system/include/libcxx/iterator +108 -417
  101. data/modules/emscripten/system/include/libcxx/limits +8 -4
  102. data/modules/emscripten/system/include/libcxx/list +28 -8
  103. data/modules/emscripten/system/include/libcxx/locale +153 -390
  104. data/modules/emscripten/system/include/libcxx/map +280 -100
  105. data/modules/emscripten/system/include/libcxx/memory +49 -97
  106. data/modules/emscripten/system/include/libcxx/mutex +2 -2
  107. data/modules/emscripten/system/include/libcxx/new +43 -14
  108. data/modules/emscripten/system/include/libcxx/numeric +2 -2
  109. data/modules/emscripten/system/include/libcxx/optional +697 -0
  110. data/modules/emscripten/system/include/libcxx/ostream +17 -8
  111. data/modules/emscripten/system/include/libcxx/queue +5 -5
  112. data/modules/emscripten/system/include/libcxx/random +53 -51
  113. data/modules/emscripten/system/include/libcxx/ratio +11 -11
  114. data/modules/emscripten/system/include/libcxx/readme.txt +1 -1
  115. data/modules/emscripten/system/include/libcxx/regex +23 -20
  116. data/modules/emscripten/system/include/libcxx/scoped_allocator +1 -1
  117. data/modules/emscripten/system/include/libcxx/set +166 -2
  118. data/modules/emscripten/system/include/libcxx/shared_mutex +419 -0
  119. data/modules/emscripten/system/include/libcxx/sstream +4 -4
  120. data/modules/emscripten/system/include/libcxx/stack +3 -3
  121. data/modules/emscripten/system/include/libcxx/streambuf +5 -5
  122. data/modules/emscripten/system/include/libcxx/string +372 -324
  123. data/modules/emscripten/system/include/libcxx/support/ibm/limits.h +99 -0
  124. data/modules/emscripten/system/include/libcxx/support/ibm/support.h +54 -0
  125. data/modules/emscripten/system/include/libcxx/support/ibm/xlocale.h +326 -0
  126. data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +6 -6
  127. data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +15 -15
  128. data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +2 -0
  129. data/modules/emscripten/system/include/libcxx/support/win32/support.h +6 -1
  130. data/modules/emscripten/system/include/libcxx/system_error +14 -8
  131. data/modules/emscripten/system/include/libcxx/thread +7 -8
  132. data/modules/emscripten/system/include/libcxx/tuple +29 -88
  133. data/modules/emscripten/system/include/libcxx/type_traits +253 -209
  134. data/modules/emscripten/system/include/libcxx/typeindex +3 -3
  135. data/modules/emscripten/system/include/libcxx/unordered_map +162 -101
  136. data/modules/emscripten/system/include/libcxx/unordered_set +79 -2
  137. data/modules/emscripten/system/include/libcxx/utility +20 -20
  138. data/modules/emscripten/system/include/libcxx/valarray +23 -23
  139. data/modules/emscripten/system/include/libcxx/vector +114 -91
  140. data/modules/emscripten/system/lib/libc/musl/src/regex/regcomp.c +3352 -0
  141. data/modules/emscripten/system/lib/libc/musl/src/regex/regerror.c +35 -0
  142. data/modules/emscripten/system/lib/libc/musl/src/regex/regexec.c +1011 -0
  143. data/modules/emscripten/system/lib/libc/musl/src/regex/tre-mem.c +158 -0
  144. data/modules/emscripten/system/lib/libc/musl/src/regex/tre.h +231 -0
  145. data/modules/emscripten/system/lib/libcextra.symbols +7 -0
  146. data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +9 -1
  147. data/modules/emscripten/system/lib/libcxx/algorithm.cpp +1 -0
  148. data/modules/emscripten/system/lib/libcxx/debug.cpp +66 -42
  149. data/modules/emscripten/system/lib/libcxx/exception.cpp +88 -16
  150. data/modules/emscripten/system/lib/libcxx/future.cpp +6 -0
  151. data/modules/emscripten/system/lib/libcxx/ios.cpp +7 -2
  152. data/modules/emscripten/system/lib/libcxx/iostream.cpp +8 -8
  153. data/modules/emscripten/system/lib/libcxx/locale.cpp +38 -11
  154. data/modules/emscripten/system/lib/libcxx/mutex.cpp +3 -0
  155. data/modules/emscripten/system/lib/libcxx/new.cpp +44 -10
  156. data/modules/emscripten/system/lib/libcxx/optional.cpp +25 -0
  157. data/modules/emscripten/system/lib/libcxx/random.cpp +26 -0
  158. data/modules/emscripten/system/lib/libcxx/readme.txt +1 -1
  159. data/modules/emscripten/system/lib/libcxx/shared_mutex.cpp +101 -0
  160. data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +11 -7
  161. data/modules/emscripten/system/lib/libcxx/string.cpp +3 -1
  162. data/modules/emscripten/system/lib/libcxx/strstream.cpp +7 -7
  163. data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +12 -13
  164. data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +33 -36
  165. data/modules/emscripten/system/lib/libcxx/symbols +187 -168
  166. data/modules/emscripten/system/lib/libcxx/system_error.cpp +1 -0
  167. data/modules/emscripten/system/lib/libcxx/thread.cpp +7 -3
  168. data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +9 -6
  169. data/modules/emscripten/system/lib/libcxx/valarray.cpp +2 -0
  170. data/modules/emscripten/third_party/lzma.js/doit.bat +4 -0
  171. data/modules/emscripten/third_party/lzma.js/doit.sh +9 -2
  172. data/modules/emscripten/tools/cache.py +5 -7
  173. data/modules/emscripten/tools/cache.pyc +0 -0
  174. data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +7 -0
  175. data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +9 -1
  176. data/modules/emscripten/tools/eliminator/eliminator-test-output.js +3 -0
  177. data/modules/emscripten/tools/eliminator/eliminator-test.js +9 -1
  178. data/modules/emscripten/tools/file_packager.py +93 -50
  179. data/modules/emscripten/tools/js-optimizer.js +98 -48
  180. data/modules/emscripten/tools/js_optimizer.py +4 -4
  181. data/modules/emscripten/tools/js_optimizer.pyc +0 -0
  182. data/modules/emscripten/tools/jsrun.py +1 -1
  183. data/modules/emscripten/tools/jsrun.pyc +0 -0
  184. data/modules/emscripten/tools/response_file.py +6 -0
  185. data/modules/emscripten/tools/response_file.pyc +0 -0
  186. data/modules/emscripten/tools/settings_template_readonly.py +2 -0
  187. data/modules/emscripten/tools/shared.py +88 -34
  188. data/modules/emscripten/tools/shared.pyc +0 -0
  189. data/modules/emscripten/tools/split.py +21 -13
  190. data/modules/mruby/build_config.rb +7 -1
  191. data/modules/mruby/doc/compile/README.md +5 -9
  192. data/modules/mruby/include/mrbconf.h +5 -2
  193. data/modules/mruby/include/mruby/array.h +1 -0
  194. data/modules/mruby/include/mruby/compile.h +2 -4
  195. data/modules/mruby/include/mruby/dump.h +7 -16
  196. data/modules/mruby/include/mruby/hash.h +1 -1
  197. data/modules/mruby/include/mruby/irep.h +14 -2
  198. data/modules/mruby/include/mruby/khash.h +8 -7
  199. data/modules/mruby/include/mruby/string.h +1 -0
  200. data/modules/mruby/include/mruby/value.h +5 -2
  201. data/modules/mruby/include/mruby.h +12 -13
  202. data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +16 -6
  203. data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +18 -30
  204. data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +21 -0
  205. data/modules/mruby/mrbgems/mruby-math/src/math.c +1 -1
  206. data/modules/mruby/mrbgems/mruby-random/src/random.c +144 -47
  207. data/modules/mruby/mrbgems/mruby-random/test/random.rb +44 -0
  208. data/modules/mruby/mrbgems/mruby-struct/src/struct.c +5 -5
  209. data/modules/mruby/mrblib/numeric.rb +99 -33
  210. data/modules/mruby/src/array.c +11 -4
  211. data/modules/mruby/src/backtrace.c +2 -2
  212. data/modules/mruby/src/class.c +49 -30
  213. data/modules/mruby/src/codegen.c +131 -79
  214. data/modules/mruby/src/debug.c +1 -1
  215. data/modules/mruby/src/dump.c +213 -163
  216. data/modules/mruby/src/error.c +17 -17
  217. data/modules/mruby/src/error.h +1 -1
  218. data/modules/mruby/src/etc.c +10 -0
  219. data/modules/mruby/src/gc.c +35 -17
  220. data/modules/mruby/src/hash.c +5 -5
  221. data/modules/mruby/src/kernel.c +36 -14
  222. data/modules/mruby/src/load.c +238 -296
  223. data/modules/mruby/src/numeric.c +18 -98
  224. data/modules/mruby/src/object.c +3 -5
  225. data/modules/mruby/src/parse.y +63 -56
  226. data/modules/mruby/src/proc.c +8 -5
  227. data/modules/mruby/src/re.h +0 -1
  228. data/modules/mruby/src/state.c +65 -27
  229. data/modules/mruby/src/string.c +3 -31
  230. data/modules/mruby/src/symbol.c +3 -3
  231. data/modules/mruby/src/variable.c +12 -5
  232. data/modules/mruby/src/vm.c +90 -72
  233. data/modules/mruby/tasks/mruby_build.rake +10 -1
  234. data/modules/mruby/tasks/toolchains/gcc.rake +12 -2
  235. data/modules/mruby/tasks/toolchains/{vs2012.rake → visualcpp.rake} +1 -1
  236. data/modules/mruby/test/driver.c +3 -3
  237. data/modules/mruby/test/t/array.rb +5 -5
  238. data/modules/mruby/test/t/class.rb +14 -1
  239. data/modules/mruby/test/t/kernel.rb +4 -0
  240. data/modules/mruby/test/t/module.rb +4 -4
  241. data/modules/mruby/test/t/nameerror.rb +1 -1
  242. data/modules/mruby/tools/mrbc/mrbc.c +23 -17
  243. data/modules/mruby/travis_config.rb +10 -1
  244. metadata +28 -5
  245. data/modules/mruby/tasks/toolchains/vs2010.rake +0 -3
@@ -0,0 +1,99 @@
1
+ // -*- C++ -*-
2
+ //===--------------------- support/ibm/limits.h ---------------------------===//
3
+ //
4
+ // The LLVM Compiler Infrastructure
5
+ //
6
+ // This file is dual licensed under the MIT and the University of Illinois Open
7
+ // Source Licenses. See LICENSE.TXT for details.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
12
+ #define _LIBCPP_SUPPORT_IBM_LIMITS_H
13
+
14
+ #if !defined(_AIX) // Linux
15
+ #include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
16
+
17
+ static const unsigned int _QNAN_F = 0x7fc00000;
18
+ #define NANF (*((float *)(&_QNAN_F)))
19
+ static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
20
+ #define NANL (*((long double *)(&_QNAN_LDBL128)))
21
+ static const unsigned int _SNAN_F= 0x7f855555;
22
+ #define NANSF (*((float *)(&_SNAN_F)))
23
+ static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
24
+ #define NANS (*((double *)(&_SNAN_D)))
25
+ static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
26
+ #define NANSL (*((long double *)(&_SNAN_LDBL128)))
27
+
28
+ #define __builtin_huge_val() HUGE_VAL
29
+ #define __builtin_huge_valf() HUGE_VALF
30
+ #define __builtin_huge_vall() HUGE_VALL
31
+ #define __builtin_nan(__dummy) NAN
32
+ #define __builtin_nanf(__dummy) NANF
33
+ #define __builtin_nanl(__dummy) NANL
34
+ #define __builtin_nans(__dummy) NANS
35
+ #define __builtin_nansf(__dummy) NANSF
36
+ #define __builtin_nansl(__dummy) NANSL
37
+
38
+ #else
39
+
40
+ #include <math.h>
41
+ #include <float.h> // limit constants
42
+
43
+ #define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
44
+ #define __builtin_huge_valf() HUGE_VALF //0x7f800000
45
+ #define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
46
+ #define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
47
+ #define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
48
+ #define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
49
+ #define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
50
+ #define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
51
+ #define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
52
+
53
+ #define __FLT_MANT_DIG__ FLT_MANT_DIG
54
+ #define __FLT_DIG__ FLT_DIG
55
+ #define __FLT_RADIX__ FLT_RADIX
56
+ #define __FLT_MIN_EXP__ FLT_MIN_EXP
57
+ #define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
58
+ #define __FLT_MAX_EXP__ FLT_MAX_EXP
59
+ #define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
60
+ #define __FLT_MIN__ FLT_MIN
61
+ #define __FLT_MAX__ FLT_MAX
62
+ #define __FLT_EPSILON__ FLT_EPSILON
63
+ // predefined by XLC on LoP
64
+ #define __FLT_DENORM_MIN__ 1.40129846e-45F
65
+
66
+ #define __DBL_MANT_DIG__ DBL_MANT_DIG
67
+ #define __DBL_DIG__ DBL_DIG
68
+ #define __DBL_MIN_EXP__ DBL_MIN_EXP
69
+ #define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
70
+ #define __DBL_MAX_EXP__ DBL_MAX_EXP
71
+ #define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
72
+ #define __DBL_MIN__ DBL_MIN
73
+ #define __DBL_MAX__ DBL_MAX
74
+ #define __DBL_EPSILON__ DBL_EPSILON
75
+ // predefined by XLC on LoP
76
+ #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
77
+
78
+ #define __LDBL_MANT_DIG__ LDBL_MANT_DIG
79
+ #define __LDBL_DIG__ LDBL_DIG
80
+ #define __LDBL_MIN_EXP__ LDBL_MIN_EXP
81
+ #define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
82
+ #define __LDBL_MAX_EXP__ LDBL_MAX_EXP
83
+ #define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
84
+ #define __LDBL_MIN__ LDBL_MIN
85
+ #define __LDBL_MAX__ LDBL_MAX
86
+ #define __LDBL_EPSILON__ LDBL_EPSILON
87
+ // predefined by XLC on LoP
88
+ #if __LONGDOUBLE128
89
+ #define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
90
+ #else
91
+ #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
92
+ #endif
93
+
94
+ // predefined by XLC on LoP
95
+ #define __CHAR_BIT__ 8
96
+
97
+ #endif // _AIX
98
+
99
+ #endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
@@ -0,0 +1,54 @@
1
+ // -*- C++ -*-
2
+ //===----------------------- support/ibm/support.h ----------------------===//
3
+ //
4
+ // The LLVM Compiler Infrastructure
5
+ //
6
+ // This file is dual licensed under the MIT and the University of Illinois Open
7
+ // Source Licenses. See LICENSE.TXT for details.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
12
+ #define _LIBCPP_SUPPORT_IBM_SUPPORT_H
13
+
14
+ extern "builtin" int __popcnt4(unsigned int);
15
+ extern "builtin" int __popcnt8(unsigned long long);
16
+ extern "builtin" unsigned int __cnttz4(unsigned int);
17
+ extern "builtin" unsigned int __cnttz8(unsigned long long);
18
+ extern "builtin" unsigned int __cntlz4(unsigned long long);
19
+ extern "builtin" unsigned int __cntlz8(unsigned long long);
20
+
21
+ // Builtin functions for counting population
22
+ #define __builtin_popcount(x) __popcnt4(x)
23
+ #define __builtin_popcountll(x) __popcnt8(x)
24
+ #if defined(__64BIT__)
25
+ #define __builtin_popcountl(x) __builtin_popcountll(x)
26
+ #else
27
+ #define __builtin_popcountl(x) __builtin_popcount(x)
28
+ #endif
29
+
30
+ // Builtin functions for counting trailing zeros
31
+ #define __builtin_ctz(x) __cnttz4(x)
32
+ #define __builtin_ctzll(x) __cnttz8(x)
33
+ #if defined(__64BIT__)
34
+ #define __builtin_ctzl(x) __builtin_ctzll(x)
35
+ #else
36
+ #define __builtin_ctzl(x) __builtin_ctz(x)
37
+ #endif
38
+
39
+ // Builtin functions for counting leading zeros
40
+ #define __builtin_clz(x) __cntlz4(x)
41
+ #define __builtin_clzll(x) __cntlz8(x)
42
+ #if defined(__64BIT__)
43
+ #define __builtin_clzl(x) __builtin_clzll(x)
44
+ #else
45
+ #define __builtin_clzl(x) __builtin_clz(x)
46
+ #endif
47
+
48
+ #if defined(__64BIT__)
49
+ #define __SIZE_WIDTH__ 64
50
+ #else
51
+ #define __SIZE_WIDTH__ 32
52
+ #endif
53
+
54
+ #endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
@@ -0,0 +1,326 @@
1
+ // -*- C++ -*-
2
+ //===--------------------- support/ibm/xlocale.h -------------------===//
3
+ //
4
+ // The LLVM Compiler Infrastructure
5
+ //
6
+ // This file is dual licensed under the MIT and the University of Illinois Open
7
+ // Source Licenses. See LICENSE.TXT for details.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
12
+ #define _LIBCPP_SUPPORT_IBM_XLOCALE_H
13
+
14
+ #if defined(_AIX)
15
+ #include "cstdlib"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #if !defined(_AIX71)
22
+ // AIX 7.1 and higher has these definitions. Definitions and stubs
23
+ // are provied here as a temporary workaround on AIX 6.1.
24
+
25
+ #define LC_COLLATE_MASK 1
26
+ #define LC_CTYPE_MASK 2
27
+ #define LC_MESSAGES_MASK 4
28
+ #define LC_MONETARY_MASK 8
29
+ #define LC_NUMERIC_MASK 16
30
+ #define LC_TIME_MASK 32
31
+ #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \
32
+ LC_MESSAGES_MASK | LC_MONETARY_MASK |\
33
+ LC_NUMERIC_MASK | LC_TIME_MASK)
34
+
35
+ typedef void* locale_t;
36
+
37
+ // The following are stubs. They are not supported on AIX 6.1.
38
+ static inline
39
+ locale_t newlocale(int category_mask, const char *locale, locale_t base)
40
+ {
41
+ _LC_locale_t *newloc, *loc;
42
+ if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL)
43
+ {
44
+ errno = EINVAL;
45
+ return (locale_t)0;
46
+ }
47
+ if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL)
48
+ {
49
+ errno = ENOMEM;
50
+ return (locale_t)0;
51
+ }
52
+ if (!base)
53
+ base = (_LC_locale_t *)__xopen_locale("C");
54
+ memcpy(newloc, base, sizeof (_LC_locale_t));
55
+ if (category_mask & LC_COLLATE_MASK)
56
+ newloc->lc_collate = loc->lc_collate;
57
+ if (category_mask & LC_CTYPE_MASK)
58
+ newloc->lc_ctype = loc->lc_ctype;
59
+ //if (category_mask & LC_MESSAGES_MASK)
60
+ // newloc->lc_messages = loc->lc_messages;
61
+ if (category_mask & LC_MONETARY_MASK)
62
+ newloc->lc_monetary = loc->lc_monetary;
63
+ if (category_mask & LC_TIME_MASK)
64
+ newloc->lc_time = loc->lc_time;
65
+ if (category_mask & LC_NUMERIC_MASK)
66
+ newloc->lc_numeric = loc->lc_numeric;
67
+ return (locale_t)newloc;
68
+ }
69
+ static inline
70
+ void freelocale(locale_t locobj)
71
+ {
72
+ free(locobj);
73
+ }
74
+ static inline
75
+ locale_t uselocale(locale_t newloc)
76
+ {
77
+ return (locale_t)0;
78
+ }
79
+
80
+ static inline
81
+ int isalnum_l(int c, locale_t locale)
82
+ {
83
+ return __xisalnum(locale, c);
84
+ }
85
+ static inline
86
+ int isalpha_l(int c, locale_t locale)
87
+ {
88
+ return __xisalpha(locale, c);
89
+ }
90
+ static inline
91
+ int isblank_l(int c, locale_t locale)
92
+ {
93
+ return __xisblank(locale, c);
94
+ }
95
+ static inline
96
+ int iscntrl_l(int c, locale_t locale)
97
+ {
98
+ return __xiscntrl(locale, c);
99
+ }
100
+ static inline
101
+ int isdigit_l(int c, locale_t locale)
102
+ {
103
+ return __xisdigit(locale, c);
104
+ }
105
+ static inline
106
+ int isgraph_l(int c, locale_t locale)
107
+ {
108
+ return __xisgraph(locale, c);
109
+ }
110
+ static inline
111
+ int islower_l(int c, locale_t locale)
112
+ {
113
+ return __xislower(locale, c);
114
+ }
115
+ static inline
116
+ int isprint_l(int c, locale_t locale)
117
+ {
118
+ return __xisprint(locale, c);
119
+ }
120
+
121
+ static inline
122
+ int ispunct_l(int c, locale_t locale)
123
+ {
124
+ return __xispunct(locale, c);
125
+ }
126
+ static inline
127
+ int isspace_l(int c, locale_t locale)
128
+ {
129
+ return __xisspace(locale, c);
130
+ }
131
+ static inline
132
+ int isupper_l(int c, locale_t locale)
133
+ {
134
+ return __xisupper(locale, c);
135
+ }
136
+
137
+ static inline
138
+ int isxdigit_l(int c, locale_t locale)
139
+ {
140
+ return __xisxdigit(locale, c);
141
+ }
142
+
143
+ static inline
144
+ int iswalnum_l(wchar_t wc, locale_t locale)
145
+ {
146
+ return __xiswalnum(locale, wc);
147
+ }
148
+
149
+ static inline
150
+ int iswalpha_l(wchar_t wc, locale_t locale)
151
+ {
152
+ return __xiswalpha(locale, wc);
153
+ }
154
+
155
+ static inline
156
+ int iswblank_l(wchar_t wc, locale_t locale)
157
+ {
158
+ return __xiswblank(locale, wc);
159
+ }
160
+
161
+ static inline
162
+ int iswcntrl_l(wchar_t wc, locale_t locale)
163
+ {
164
+ return __xiswcntrl(locale, wc);
165
+ }
166
+
167
+ static inline
168
+ int iswdigit_l(wchar_t wc, locale_t locale)
169
+ {
170
+ return __xiswdigit(locale, wc);
171
+ }
172
+
173
+ static inline
174
+ int iswgraph_l(wchar_t wc, locale_t locale)
175
+ {
176
+ return __xiswgraph(locale, wc);
177
+ }
178
+
179
+ static inline
180
+ int iswlower_l(wchar_t wc, locale_t locale)
181
+ {
182
+ return __xiswlower(locale, wc);
183
+ }
184
+
185
+ static inline
186
+ int iswprint_l(wchar_t wc, locale_t locale)
187
+ {
188
+ return __xiswprint(locale, wc);
189
+ }
190
+
191
+ static inline
192
+ int iswpunct_l(wchar_t wc, locale_t locale)
193
+ {
194
+ return __xiswpunct(locale, wc);
195
+ }
196
+
197
+ static inline
198
+ int iswspace_l(wchar_t wc, locale_t locale)
199
+ {
200
+ return __xiswspace(locale, wc);
201
+ }
202
+
203
+ static inline
204
+ int iswupper_l(wchar_t wc, locale_t locale)
205
+ {
206
+ return __xiswupper(locale, wc);
207
+ }
208
+
209
+ static inline
210
+ int iswxdigit_l(wchar_t wc, locale_t locale)
211
+ {
212
+ return __xiswxdigit(locale, wc);
213
+ }
214
+
215
+ static inline
216
+ int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
217
+ {
218
+ return __xiswctype(locale, wc, desc);
219
+ }
220
+
221
+ static inline
222
+ int toupper_l(int c, locale_t locale)
223
+ {
224
+ return __xtoupper(locale, c);
225
+ }
226
+ static inline
227
+ int tolower_l(int c, locale_t locale)
228
+ {
229
+ return __xtolower(locale, c);
230
+ }
231
+ static inline
232
+ wint_t towupper_l(wint_t wc, locale_t locale)
233
+ {
234
+ return __xtowupper(locale, wc);
235
+ }
236
+ static inline
237
+ wint_t towlower_l(wint_t wc, locale_t locale)
238
+ {
239
+ return __xtowlower(locale, wc);
240
+ }
241
+
242
+ static inline
243
+ int strcoll_l(const char *__s1, const char *__s2, locale_t locale)
244
+ {
245
+ return __xstrcoll(locale, __s1, __s2);
246
+ }
247
+ static inline
248
+ int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale)
249
+ {
250
+ return __xwcscoll(locale, __s1, __s2);
251
+ }
252
+ static inline
253
+ size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale)
254
+ {
255
+ return __xstrxfrm(locale, __s1, __s2, __n);
256
+ }
257
+
258
+ static inline
259
+ size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
260
+ locale_t locale)
261
+ {
262
+ return __xwcsxfrm(locale, __ws1, __ws2, __n);
263
+ }
264
+ #endif // !defined(_AIX71)
265
+
266
+ // strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
267
+ // implemented yet.
268
+ static inline
269
+ size_t strftime_l(char *__s, size_t __size, const char *__fmt,
270
+ const struct tm *__tm, locale_t locale) {
271
+ return __xstrftime(locale, __s, __size, __fmt, __tm);
272
+ }
273
+
274
+ // The following are not POSIX routines. These are quick-and-dirty hacks
275
+ // to make things pretend to work
276
+ static inline
277
+ long long strtoll_l(const char *__nptr, char **__endptr,
278
+ int __base, locale_t locale) {
279
+ return strtoll(__nptr, __endptr, __base);
280
+ }
281
+ static inline
282
+ long strtol_l(const char *__nptr, char **__endptr,
283
+ int __base, locale_t locale) {
284
+ return strtol(__nptr, __endptr, __base);
285
+ }
286
+ static inline
287
+ long double strtold_l(const char *__nptr, char **__endptr,
288
+ locale_t locale) {
289
+ return strtold(__nptr, __endptr);
290
+ }
291
+ static inline
292
+ unsigned long long strtoull_l(const char *__nptr, char **__endptr,
293
+ int __base, locale_t locale) {
294
+ return strtoull(__nptr, __endptr, __base);
295
+ }
296
+ static inline
297
+ unsigned long strtoul_l(const char *__nptr, char **__endptr,
298
+ int __base, locale_t locale) {
299
+ return strtoul(__nptr, __endptr, __base);
300
+ }
301
+
302
+ static inline
303
+ int vasprintf(char **strp, const char *fmt, va_list ap)
304
+ {
305
+ const size_t buff_size = 256;
306
+ int str_size;
307
+ if ((*strp = (char *)malloc(buff_size)) == NULL)
308
+ {
309
+ return -1;
310
+ }
311
+ if ((str_size = vsnprintf(*strp, buff_size, fmt, ap)) >= buff_size)
312
+ {
313
+ if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL)
314
+ {
315
+ return -1;
316
+ }
317
+ str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
318
+ }
319
+ return str_size;
320
+ }
321
+
322
+ #ifdef __cplusplus
323
+ }
324
+ #endif
325
+ #endif // defined(_AIX)
326
+ #endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
@@ -12,16 +12,15 @@
12
12
  #define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
13
13
 
14
14
  #if !defined(_LIBCPP_MSVCRT)
15
- #error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
15
+ #error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
16
16
  #else
17
17
 
18
- #ifndef NOMINMAX
19
- #define NOMINMAX
20
- #endif
21
- #include <windows.h> // ymath.h works correctly
22
-
18
+ #include <limits.h> // CHAR_BIT
23
19
  #include <float.h> // limit constants
24
20
 
21
+ #if ! defined(__clang__)
22
+ #define __CHAR_BIT__ CHAR_BIT
23
+
25
24
  #define __FLT_MANT_DIG__ FLT_MANT_DIG
26
25
  #define __FLT_DIG__ FLT_DIG
27
26
  #define __FLT_RADIX__ FLT_RADIX
@@ -73,6 +72,7 @@
73
72
  #define __builtin_nans(__dummy) _Snan._Double
74
73
  #define __builtin_nansf(__dummy) _FSnan._Float
75
74
  #define __builtin_nansl(__dummy) _LSnan._Long_double
75
+ #endif // ! defined(__clang__)
76
76
 
77
77
  #endif // _LIBCPP_MSVCRT
78
78
 
@@ -15,6 +15,7 @@
15
15
  extern "C" unsigned short __declspec(dllimport) _ctype[];
16
16
 
17
17
  #include "support/win32/support.h"
18
+ #include <stdio.h>
18
19
  #include <memory>
19
20
  #include <xlocinfo.h> // _locale_t
20
21
  #define locale_t _locale_t
@@ -35,23 +36,23 @@ extern "C" unsigned short __declspec(dllimport) _ctype[];
35
36
  locale_t newlocale( int mask, const char * locale, locale_t base );
36
37
  locale_t uselocale( locale_t newloc );
37
38
  lconv *localeconv_l( locale_t loc );
38
- size_t mbrlen_l( const char *__restrict__ s, size_t n,
39
- mbstate_t *__restrict__ ps, locale_t loc);
40
- size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
41
- size_t len, mbstate_t *__restrict__ ps, locale_t loc );
42
- size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
39
+ size_t mbrlen_l( const char *__restrict s, size_t n,
40
+ mbstate_t *__restrict ps, locale_t loc);
41
+ size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
42
+ size_t len, mbstate_t *__restrict ps, locale_t loc );
43
+ size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps,
43
44
  locale_t loc);
44
- size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
45
- size_t n, mbstate_t *__restrict__ ps, locale_t loc);
46
- size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
47
- size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
48
- size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
49
- size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
45
+ size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s,
46
+ size_t n, mbstate_t *__restrict ps, locale_t loc);
47
+ size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
48
+ size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc);
49
+ size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src,
50
+ size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
50
51
  wint_t btowc_l( int c, locale_t loc );
51
52
  int wctob_l( wint_t c, locale_t loc );
52
53
  typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
53
54
  typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
54
- _LIBCPP_ALWAYS_INLINE inline
55
+ inline _LIBCPP_ALWAYS_INLINE
55
56
  decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
56
57
  {
57
58
  __locale_raii __current( uselocale(__l), uselocale );
@@ -59,7 +60,6 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
59
60
  }
60
61
 
61
62
  // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
62
- #include <stdio.h>
63
63
  #define mbtowc_l _mbtowc_l
64
64
  #define strtoll_l _strtoi64_l
65
65
  #define strtoull_l _strtoui64_l
@@ -120,10 +120,10 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ )
120
120
  return ( c == L' ' || c == L'\t' );
121
121
  }
122
122
 
123
- #ifdef _MSC_VER
123
+ #if defined(_LIBCPP_MSVCRT)
124
124
  inline int isblank( int c, locale_t /*loc*/ )
125
125
  { return ( c == ' ' || c == '\t' ); }
126
126
  inline int iswblank( wint_t c, locale_t /*loc*/ )
127
127
  { return ( c == L' ' || c == L'\t' ); }
128
- #endif // _MSC_VER
128
+ #endif // _LIBCPP_MSVCRT
129
129
  #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
@@ -16,7 +16,9 @@
16
16
  #else
17
17
 
18
18
  #include <math.h>
19
+ #include <float.h> // _FPCLASS_PN etc.
19
20
 
21
+ // Necessary?
20
22
  typedef float float_t;
21
23
  typedef double double_t;
22
24
 
@@ -15,11 +15,16 @@
15
15
  Functions and constants used in libc++ that are missing from the Windows C library.
16
16
  */
17
17
 
18
- #include <cwchar> // mbstate_t
18
+ #include <wchar.h> // mbstate_t
19
19
  #include <cstdarg> // va_ macros
20
20
  #define swprintf _snwprintf
21
21
  #define vswprintf _vsnwprintf
22
22
 
23
+ #ifndef NOMINMAX
24
+ #define NOMINMAX
25
+ #endif
26
+ #include <Windows.h>
27
+
23
28
  extern "C" {
24
29
 
25
30
  int vasprintf( char **sptr, const char *__restrict fmt, va_list ap );
@@ -22,6 +22,7 @@ class error_category
22
22
  public:
23
23
  virtual ~error_category() noexcept;
24
24
 
25
+ constexpr error_category();
25
26
  error_category(const error_category&) = delete;
26
27
  error_category& operator=(const error_category&) = delete;
27
28
 
@@ -232,13 +233,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
232
233
  // is_error_code_enum
233
234
 
234
235
  template <class _Tp>
235
- struct _LIBCPP_TYPE_VIS is_error_code_enum
236
+ struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum
236
237
  : public false_type {};
237
238
 
238
239
  // is_error_condition_enum
239
240
 
240
241
  template <class _Tp>
241
- struct _LIBCPP_TYPE_VIS is_error_condition_enum
242
+ struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum
242
243
  : public false_type {};
243
244
 
244
245
  // Some error codes are not present on all platforms, so we provide equivalents
@@ -345,12 +346,12 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
345
346
  _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
346
347
 
347
348
  template <>
348
- struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc>
349
+ struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc>
349
350
  : true_type { };
350
351
 
351
352
  #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
352
353
  template <>
353
- struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc::__lx>
354
+ struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc::__lx>
354
355
  : true_type { };
355
356
  #endif
356
357
 
@@ -366,7 +367,12 @@ class _LIBCPP_TYPE_VIS error_category
366
367
  public:
367
368
  virtual ~error_category() _NOEXCEPT;
368
369
 
370
+ #ifdef _LIBCPP_BUILDING_SYSTEM_ERROR
369
371
  error_category() _NOEXCEPT;
372
+ #else
373
+ _LIBCPP_ALWAYS_INLINE
374
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT;
375
+ #endif
370
376
  private:
371
377
  error_category(const error_category&);// = delete;
372
378
  error_category& operator=(const error_category&);// = delete;
@@ -397,8 +403,8 @@ public:
397
403
  virtual string message(int ev) const;
398
404
  };
399
405
 
400
- const error_category& generic_category() _NOEXCEPT;
401
- const error_category& system_category() _NOEXCEPT;
406
+ _LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT;
407
+ _LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT;
402
408
 
403
409
  class _LIBCPP_TYPE_VIS error_condition
404
410
  {
@@ -597,7 +603,7 @@ operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
597
603
  {return !(__x == __y);}
598
604
 
599
605
  template <>
600
- struct _LIBCPP_TYPE_VIS hash<error_code>
606
+ struct _LIBCPP_TYPE_VIS_ONLY hash<error_code>
601
607
  : public unary_function<error_code, size_t>
602
608
  {
603
609
  _LIBCPP_INLINE_VISIBILITY
@@ -629,7 +635,7 @@ private:
629
635
  static string __init(const error_code&, string);
630
636
  };
631
637
 
632
- void __throw_system_error(int ev, const char* what_arg);
638
+ _LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg);
633
639
 
634
640
  _LIBCPP_END_NAMESPACE_STD
635
641