libv8 3.3.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,99 @@
1
+ """SCons.Tool.zip
2
+
3
+ Tool-specific initialization for zip.
4
+
5
+ There normally shouldn't be any need to import this module directly.
6
+ It will usually be imported through the generic SCons.Tool.Tool()
7
+ selection method.
8
+
9
+ """
10
+
11
+ #
12
+ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
13
+ #
14
+ # Permission is hereby granted, free of charge, to any person obtaining
15
+ # a copy of this software and associated documentation files (the
16
+ # "Software"), to deal in the Software without restriction, including
17
+ # without limitation the rights to use, copy, modify, merge, publish,
18
+ # distribute, sublicense, and/or sell copies of the Software, and to
19
+ # permit persons to whom the Software is furnished to do so, subject to
20
+ # the following conditions:
21
+ #
22
+ # The above copyright notice and this permission notice shall be included
23
+ # in all copies or substantial portions of the Software.
24
+ #
25
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
26
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
27
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ #
33
+
34
+ __revision__ = "src/engine/SCons/Tool/zip.py 5134 2010/08/16 23:02:40 bdeegan"
35
+
36
+ import os.path
37
+
38
+ import SCons.Builder
39
+ import SCons.Defaults
40
+ import SCons.Node.FS
41
+ import SCons.Util
42
+
43
+ try:
44
+ import zipfile
45
+ internal_zip = 1
46
+ except ImportError:
47
+ internal_zip = 0
48
+
49
+ if internal_zip:
50
+ zipcompression = zipfile.ZIP_DEFLATED
51
+ def zip(target, source, env):
52
+ compression = env.get('ZIPCOMPRESSION', 0)
53
+ zf = zipfile.ZipFile(str(target[0]), 'w', compression)
54
+ for s in source:
55
+ if s.isdir():
56
+ for dirpath, dirnames, filenames in os.walk(str(s)):
57
+ for fname in filenames:
58
+ path = os.path.join(dirpath, fname)
59
+ if os.path.isfile(path):
60
+ zf.write(path)
61
+ else:
62
+ zf.write(str(s))
63
+ zf.close()
64
+ else:
65
+ zipcompression = 0
66
+ zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES"
67
+
68
+
69
+ zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION'])
70
+
71
+ ZipBuilder = SCons.Builder.Builder(action = SCons.Action.Action('$ZIPCOM', '$ZIPCOMSTR'),
72
+ source_factory = SCons.Node.FS.Entry,
73
+ source_scanner = SCons.Defaults.DirScanner,
74
+ suffix = '$ZIPSUFFIX',
75
+ multi = 1)
76
+
77
+
78
+ def generate(env):
79
+ """Add Builders and construction variables for zip to an Environment."""
80
+ try:
81
+ bld = env['BUILDERS']['Zip']
82
+ except KeyError:
83
+ bld = ZipBuilder
84
+ env['BUILDERS']['Zip'] = bld
85
+
86
+ env['ZIP'] = 'zip'
87
+ env['ZIPFLAGS'] = SCons.Util.CLVar('')
88
+ env['ZIPCOM'] = zipAction
89
+ env['ZIPCOMPRESSION'] = zipcompression
90
+ env['ZIPSUFFIX'] = '.zip'
91
+
92
+ def exists(env):
93
+ return internal_zip or env.Detect('zip')
94
+
95
+ # Local Variables:
96
+ # tab-width:4
97
+ # indent-tabs-mode:nil
98
+ # End:
99
+ # vim: set expandtab tabstop=4 shiftwidth=4:
@@ -0,0 +1,1492 @@
1
+ """SCons.Util
2
+
3
+ Various utility functions go here.
4
+ """
5
+ #
6
+ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be included
17
+ # in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
20
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
21
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ __revision__ = "src/engine/SCons/Util.py 5134 2010/08/16 23:02:40 bdeegan"
28
+
29
+ import os
30
+ import sys
31
+ import copy
32
+ import re
33
+ import types
34
+
35
+ from collections import UserDict, UserList, UserString
36
+
37
+ # Don't "from types import ..." these because we need to get at the
38
+ # types module later to look for UnicodeType.
39
+ InstanceType = types.InstanceType
40
+ MethodType = types.MethodType
41
+ FunctionType = types.FunctionType
42
+ try: unicode
43
+ except NameError: UnicodeType = None
44
+ else: UnicodeType = unicode
45
+
46
+ def dictify(keys, values, result={}):
47
+ for k, v in zip(keys, values):
48
+ result[k] = v
49
+ return result
50
+
51
+ _altsep = os.altsep
52
+ if _altsep is None and sys.platform == 'win32':
53
+ # My ActivePython 2.0.1 doesn't set os.altsep! What gives?
54
+ _altsep = '/'
55
+ if _altsep:
56
+ def rightmost_separator(path, sep):
57
+ return max(path.rfind(sep), path.rfind(_altsep))
58
+ else:
59
+ def rightmost_separator(path, sep):
60
+ return path.rfind(sep)
61
+
62
+ # First two from the Python Cookbook, just for completeness.
63
+ # (Yeah, yeah, YAGNI...)
64
+ def containsAny(str, set):
65
+ """Check whether sequence str contains ANY of the items in set."""
66
+ for c in set:
67
+ if c in str: return 1
68
+ return 0
69
+
70
+ def containsAll(str, set):
71
+ """Check whether sequence str contains ALL of the items in set."""
72
+ for c in set:
73
+ if c not in str: return 0
74
+ return 1
75
+
76
+ def containsOnly(str, set):
77
+ """Check whether sequence str contains ONLY items in set."""
78
+ for c in str:
79
+ if c not in set: return 0
80
+ return 1
81
+
82
+ def splitext(path):
83
+ "Same as os.path.splitext() but faster."
84
+ sep = rightmost_separator(path, os.sep)
85
+ dot = path.rfind('.')
86
+ # An ext is only real if it has at least one non-digit char
87
+ if dot > sep and not containsOnly(path[dot:], "0123456789."):
88
+ return path[:dot],path[dot:]
89
+ else:
90
+ return path,""
91
+
92
+ def updrive(path):
93
+ """
94
+ Make the drive letter (if any) upper case.
95
+ This is useful because Windows is inconsitent on the case
96
+ of the drive letter, which can cause inconsistencies when
97
+ calculating command signatures.
98
+ """
99
+ drive, rest = os.path.splitdrive(path)
100
+ if drive:
101
+ path = drive.upper() + rest
102
+ return path
103
+
104
+ class NodeList(UserList):
105
+ """This class is almost exactly like a regular list of Nodes
106
+ (actually it can hold any object), with one important difference.
107
+ If you try to get an attribute from this list, it will return that
108
+ attribute from every item in the list. For example:
109
+
110
+ >>> someList = NodeList([ ' foo ', ' bar ' ])
111
+ >>> someList.strip()
112
+ [ 'foo', 'bar' ]
113
+ """
114
+ def __nonzero__(self):
115
+ return len(self.data) != 0
116
+
117
+ def __str__(self):
118
+ return ' '.join(map(str, self.data))
119
+
120
+ def __iter__(self):
121
+ return iter(self.data)
122
+
123
+ def __call__(self, *args, **kwargs):
124
+ result = [x(*args, **kwargs) for x in self.data]
125
+ return self.__class__(result)
126
+
127
+ def __getattr__(self, name):
128
+ result = [getattr(x, name) for x in self.data]
129
+ return self.__class__(result)
130
+
131
+
132
+ _get_env_var = re.compile(r'^\$([_a-zA-Z]\w*|{[_a-zA-Z]\w*})$')
133
+
134
+ def get_environment_var(varstr):
135
+ """Given a string, first determine if it looks like a reference
136
+ to a single environment variable, like "$FOO" or "${FOO}".
137
+ If so, return that variable with no decorations ("FOO").
138
+ If not, return None."""
139
+ mo=_get_env_var.match(to_String(varstr))
140
+ if mo:
141
+ var = mo.group(1)
142
+ if var[0] == '{':
143
+ return var[1:-1]
144
+ else:
145
+ return var
146
+ else:
147
+ return None
148
+
149
+ class DisplayEngine(object):
150
+ print_it = True
151
+ def __call__(self, text, append_newline=1):
152
+ if not self.print_it:
153
+ return
154
+ if append_newline: text = text + '\n'
155
+ try:
156
+ sys.stdout.write(unicode(text))
157
+ except IOError:
158
+ # Stdout might be connected to a pipe that has been closed
159
+ # by now. The most likely reason for the pipe being closed
160
+ # is that the user has press ctrl-c. It this is the case,
161
+ # then SCons is currently shutdown. We therefore ignore
162
+ # IOError's here so that SCons can continue and shutdown
163
+ # properly so that the .sconsign is correctly written
164
+ # before SCons exits.
165
+ pass
166
+
167
+ def set_mode(self, mode):
168
+ self.print_it = mode
169
+
170
+ def render_tree(root, child_func, prune=0, margin=[0], visited={}):
171
+ """
172
+ Render a tree of nodes into an ASCII tree view.
173
+ root - the root node of the tree
174
+ child_func - the function called to get the children of a node
175
+ prune - don't visit the same node twice
176
+ margin - the format of the left margin to use for children of root.
177
+ 1 results in a pipe, and 0 results in no pipe.
178
+ visited - a dictionary of visited nodes in the current branch if not prune,
179
+ or in the whole tree if prune.
180
+ """
181
+
182
+ rname = str(root)
183
+
184
+ children = child_func(root)
185
+ retval = ""
186
+ for pipe in margin[:-1]:
187
+ if pipe:
188
+ retval = retval + "| "
189
+ else:
190
+ retval = retval + " "
191
+
192
+ if rname in visited:
193
+ return retval + "+-[" + rname + "]\n"
194
+
195
+ retval = retval + "+-" + rname + "\n"
196
+ if not prune:
197
+ visited = copy.copy(visited)
198
+ visited[rname] = 1
199
+
200
+ for i in range(len(children)):
201
+ margin.append(i<len(children)-1)
202
+ retval = retval + render_tree(children[i], child_func, prune, margin, visited
203
+ )
204
+ margin.pop()
205
+
206
+ return retval
207
+
208
+ IDX = lambda N: N and 1 or 0
209
+
210
+ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
211
+ """
212
+ Print a tree of nodes. This is like render_tree, except it prints
213
+ lines directly instead of creating a string representation in memory,
214
+ so that huge trees can be printed.
215
+
216
+ root - the root node of the tree
217
+ child_func - the function called to get the children of a node
218
+ prune - don't visit the same node twice
219
+ showtags - print status information to the left of each node line
220
+ margin - the format of the left margin to use for children of root.
221
+ 1 results in a pipe, and 0 results in no pipe.
222
+ visited - a dictionary of visited nodes in the current branch if not prune,
223
+ or in the whole tree if prune.
224
+ """
225
+
226
+ rname = str(root)
227
+
228
+ if showtags:
229
+
230
+ if showtags == 2:
231
+ legend = (' E = exists\n' +
232
+ ' R = exists in repository only\n' +
233
+ ' b = implicit builder\n' +
234
+ ' B = explicit builder\n' +
235
+ ' S = side effect\n' +
236
+ ' P = precious\n' +
237
+ ' A = always build\n' +
238
+ ' C = current\n' +
239
+ ' N = no clean\n' +
240
+ ' H = no cache\n' +
241
+ '\n')
242
+ sys.stdout.write(unicode(legend))
243
+
244
+ tags = ['[']
245
+ tags.append(' E'[IDX(root.exists())])
246
+ tags.append(' R'[IDX(root.rexists() and not root.exists())])
247
+ tags.append(' BbB'[[0,1][IDX(root.has_explicit_builder())] +
248
+ [0,2][IDX(root.has_builder())]])
249
+ tags.append(' S'[IDX(root.side_effect)])
250
+ tags.append(' P'[IDX(root.precious)])
251
+ tags.append(' A'[IDX(root.always_build)])
252
+ tags.append(' C'[IDX(root.is_up_to_date())])
253
+ tags.append(' N'[IDX(root.noclean)])
254
+ tags.append(' H'[IDX(root.nocache)])
255
+ tags.append(']')
256
+
257
+ else:
258
+ tags = []
259
+
260
+ def MMM(m):
261
+ return [" ","| "][m]
262
+ margins = list(map(MMM, margin[:-1]))
263
+
264
+ children = child_func(root)
265
+
266
+ if prune and rname in visited and children:
267
+ sys.stdout.write(''.join(tags + margins + ['+-[', rname, ']']) + u'\n')
268
+ return
269
+
270
+ sys.stdout.write(''.join(tags + margins + ['+-', rname]) + u'\n')
271
+
272
+ visited[rname] = 1
273
+
274
+ if children:
275
+ margin.append(1)
276
+ idx = IDX(showtags)
277
+ for C in children[:-1]:
278
+ print_tree(C, child_func, prune, idx, margin, visited)
279
+ margin[-1] = 0
280
+ print_tree(children[-1], child_func, prune, idx, margin, visited)
281
+ margin.pop()
282
+
283
+
284
+
285
+ # Functions for deciding if things are like various types, mainly to
286
+ # handle UserDict, UserList and UserString like their underlying types.
287
+ #
288
+ # Yes, all of this manual testing breaks polymorphism, and the real
289
+ # Pythonic way to do all of this would be to just try it and handle the
290
+ # exception, but handling the exception when it's not the right type is
291
+ # often too slow.
292
+
293
+ # We are using the following trick to speed up these
294
+ # functions. Default arguments are used to take a snapshot of the
295
+ # the global functions and constants used by these functions. This
296
+ # transforms accesses to global variable into local variables
297
+ # accesses (i.e. LOAD_FAST instead of LOAD_GLOBAL).
298
+
299
+ DictTypes = (dict, UserDict)
300
+ ListTypes = (list, UserList)
301
+ SequenceTypes = (list, tuple, UserList)
302
+
303
+ # Note that profiling data shows a speed-up when comparing
304
+ # explicitely with str and unicode instead of simply comparing
305
+ # with basestring. (at least on Python 2.5.1)
306
+ StringTypes = (str, unicode, UserString)
307
+
308
+ # Empirically, it is faster to check explicitely for str and
309
+ # unicode than for basestring.
310
+ BaseStringTypes = (str, unicode)
311
+
312
+ def is_Dict(obj, isinstance=isinstance, DictTypes=DictTypes):
313
+ return isinstance(obj, DictTypes)
314
+
315
+ def is_List(obj, isinstance=isinstance, ListTypes=ListTypes):
316
+ return isinstance(obj, ListTypes)
317
+
318
+ def is_Sequence(obj, isinstance=isinstance, SequenceTypes=SequenceTypes):
319
+ return isinstance(obj, SequenceTypes)
320
+
321
+ def is_Tuple(obj, isinstance=isinstance, tuple=tuple):
322
+ return isinstance(obj, tuple)
323
+
324
+ def is_String(obj, isinstance=isinstance, StringTypes=StringTypes):
325
+ return isinstance(obj, StringTypes)
326
+
327
+ def is_Scalar(obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes):
328
+ # Profiling shows that there is an impressive speed-up of 2x
329
+ # when explicitely checking for strings instead of just not
330
+ # sequence when the argument (i.e. obj) is already a string.
331
+ # But, if obj is a not string then it is twice as fast to
332
+ # check only for 'not sequence'. The following code therefore
333
+ # assumes that the obj argument is a string must of the time.
334
+ return isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes)
335
+
336
+ def do_flatten(sequence, result, isinstance=isinstance,
337
+ StringTypes=StringTypes, SequenceTypes=SequenceTypes):
338
+ for item in sequence:
339
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
340
+ result.append(item)
341
+ else:
342
+ do_flatten(item, result)
343
+
344
+ def flatten(obj, isinstance=isinstance, StringTypes=StringTypes,
345
+ SequenceTypes=SequenceTypes, do_flatten=do_flatten):
346
+ """Flatten a sequence to a non-nested list.
347
+
348
+ Flatten() converts either a single scalar or a nested sequence
349
+ to a non-nested list. Note that flatten() considers strings
350
+ to be scalars instead of sequences like Python would.
351
+ """
352
+ if isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes):
353
+ return [obj]
354
+ result = []
355
+ for item in obj:
356
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
357
+ result.append(item)
358
+ else:
359
+ do_flatten(item, result)
360
+ return result
361
+
362
+ def flatten_sequence(sequence, isinstance=isinstance, StringTypes=StringTypes,
363
+ SequenceTypes=SequenceTypes, do_flatten=do_flatten):
364
+ """Flatten a sequence to a non-nested list.
365
+
366
+ Same as flatten(), but it does not handle the single scalar
367
+ case. This is slightly more efficient when one knows that
368
+ the sequence to flatten can not be a scalar.
369
+ """
370
+ result = []
371
+ for item in sequence:
372
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
373
+ result.append(item)
374
+ else:
375
+ do_flatten(item, result)
376
+ return result
377
+
378
+ # Generic convert-to-string functions that abstract away whether or
379
+ # not the Python we're executing has Unicode support. The wrapper
380
+ # to_String_for_signature() will use a for_signature() method if the
381
+ # specified object has one.
382
+ #
383
+ def to_String(s,
384
+ isinstance=isinstance, str=str,
385
+ UserString=UserString, BaseStringTypes=BaseStringTypes):
386
+ if isinstance(s,BaseStringTypes):
387
+ # Early out when already a string!
388
+ return s
389
+ elif isinstance(s, UserString):
390
+ # s.data can only be either a unicode or a regular
391
+ # string. Please see the UserString initializer.
392
+ return s.data
393
+ else:
394
+ return str(s)
395
+
396
+ def to_String_for_subst(s,
397
+ isinstance=isinstance, str=str, to_String=to_String,
398
+ BaseStringTypes=BaseStringTypes, SequenceTypes=SequenceTypes,
399
+ UserString=UserString):
400
+
401
+ # Note that the test cases are sorted by order of probability.
402
+ if isinstance(s, BaseStringTypes):
403
+ return s
404
+ elif isinstance(s, SequenceTypes):
405
+ l = []
406
+ for e in s:
407
+ l.append(to_String_for_subst(e))
408
+ return ' '.join( s )
409
+ elif isinstance(s, UserString):
410
+ # s.data can only be either a unicode or a regular
411
+ # string. Please see the UserString initializer.
412
+ return s.data
413
+ else:
414
+ return str(s)
415
+
416
+ def to_String_for_signature(obj, to_String_for_subst=to_String_for_subst,
417
+ AttributeError=AttributeError):
418
+ try:
419
+ f = obj.for_signature
420
+ except AttributeError:
421
+ return to_String_for_subst(obj)
422
+ else:
423
+ return f()
424
+
425
+
426
+ # The SCons "semi-deep" copy.
427
+ #
428
+ # This makes separate copies of lists (including UserList objects)
429
+ # dictionaries (including UserDict objects) and tuples, but just copies
430
+ # references to anything else it finds.
431
+ #
432
+ # A special case is any object that has a __semi_deepcopy__() method,
433
+ # which we invoke to create the copy, which is used by the BuilderDict
434
+ # class because of its extra initialization argument.
435
+ #
436
+ # The dispatch table approach used here is a direct rip-off from the
437
+ # normal Python copy module.
438
+
439
+ _semi_deepcopy_dispatch = d = {}
440
+
441
+ def _semi_deepcopy_dict(x):
442
+ copy = {}
443
+ for key, val in x.items():
444
+ # The regular Python copy.deepcopy() also deepcopies the key,
445
+ # as follows:
446
+ #
447
+ # copy[semi_deepcopy(key)] = semi_deepcopy(val)
448
+ #
449
+ # Doesn't seem like we need to, but we'll comment it just in case.
450
+ copy[key] = semi_deepcopy(val)
451
+ return copy
452
+ d[dict] = _semi_deepcopy_dict
453
+
454
+ def _semi_deepcopy_list(x):
455
+ return list(map(semi_deepcopy, x))
456
+ d[list] = _semi_deepcopy_list
457
+
458
+ def _semi_deepcopy_tuple(x):
459
+ return tuple(map(semi_deepcopy, x))
460
+ d[tuple] = _semi_deepcopy_tuple
461
+
462
+ def semi_deepcopy(x):
463
+ copier = _semi_deepcopy_dispatch.get(type(x))
464
+ if copier:
465
+ return copier(x)
466
+ else:
467
+ if hasattr(x, '__semi_deepcopy__'):
468
+ return x.__semi_deepcopy__()
469
+ elif isinstance(x, UserDict):
470
+ return x.__class__(_semi_deepcopy_dict(x))
471
+ elif isinstance(x, UserList):
472
+ return x.__class__(_semi_deepcopy_list(x))
473
+
474
+ return x
475
+
476
+
477
+
478
+ class Proxy(object):
479
+ """A simple generic Proxy class, forwarding all calls to
480
+ subject. So, for the benefit of the python newbie, what does
481
+ this really mean? Well, it means that you can take an object, let's
482
+ call it 'objA', and wrap it in this Proxy class, with a statement
483
+ like this
484
+
485
+ proxyObj = Proxy(objA),
486
+
487
+ Then, if in the future, you do something like this
488
+
489
+ x = proxyObj.var1,
490
+
491
+ since Proxy does not have a 'var1' attribute (but presumably objA does),
492
+ the request actually is equivalent to saying
493
+
494
+ x = objA.var1
495
+
496
+ Inherit from this class to create a Proxy.
497
+
498
+ Note that, with new-style classes, this does *not* work transparently
499
+ for Proxy subclasses that use special .__*__() method names, because
500
+ those names are now bound to the class, not the individual instances.
501
+ You now need to know in advance which .__*__() method names you want
502
+ to pass on to the underlying Proxy object, and specifically delegate
503
+ their calls like this:
504
+
505
+ class Foo(Proxy):
506
+ __str__ = Delegate('__str__')
507
+ """
508
+
509
+ def __init__(self, subject):
510
+ """Wrap an object as a Proxy object"""
511
+ self._subject = subject
512
+
513
+ def __getattr__(self, name):
514
+ """Retrieve an attribute from the wrapped object. If the named
515
+ attribute doesn't exist, AttributeError is raised"""
516
+ return getattr(self._subject, name)
517
+
518
+ def get(self):
519
+ """Retrieve the entire wrapped object"""
520
+ return self._subject
521
+
522
+ def __cmp__(self, other):
523
+ if issubclass(other.__class__, self._subject.__class__):
524
+ return cmp(self._subject, other)
525
+ return cmp(self.__dict__, other.__dict__)
526
+
527
+ class Delegate(object):
528
+ """A Python Descriptor class that delegates attribute fetches
529
+ to an underlying wrapped subject of a Proxy. Typical use:
530
+
531
+ class Foo(Proxy):
532
+ __str__ = Delegate('__str__')
533
+ """
534
+ def __init__(self, attribute):
535
+ self.attribute = attribute
536
+ def __get__(self, obj, cls):
537
+ if isinstance(obj, cls):
538
+ return getattr(obj._subject, self.attribute)
539
+ else:
540
+ return self
541
+
542
+ # attempt to load the windows registry module:
543
+ can_read_reg = 0
544
+ try:
545
+ import winreg
546
+
547
+ can_read_reg = 1
548
+ hkey_mod = winreg
549
+
550
+ RegOpenKeyEx = winreg.OpenKeyEx
551
+ RegEnumKey = winreg.EnumKey
552
+ RegEnumValue = winreg.EnumValue
553
+ RegQueryValueEx = winreg.QueryValueEx
554
+ RegError = winreg.error
555
+
556
+ except ImportError:
557
+ try:
558
+ import win32api
559
+ import win32con
560
+ can_read_reg = 1
561
+ hkey_mod = win32con
562
+
563
+ RegOpenKeyEx = win32api.RegOpenKeyEx
564
+ RegEnumKey = win32api.RegEnumKey
565
+ RegEnumValue = win32api.RegEnumValue
566
+ RegQueryValueEx = win32api.RegQueryValueEx
567
+ RegError = win32api.error
568
+
569
+ except ImportError:
570
+ class _NoError(Exception):
571
+ pass
572
+ RegError = _NoError
573
+
574
+ if can_read_reg:
575
+ HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT
576
+ HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
577
+ HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER
578
+ HKEY_USERS = hkey_mod.HKEY_USERS
579
+
580
+ def RegGetValue(root, key):
581
+ """This utility function returns a value in the registry
582
+ without having to open the key first. Only available on
583
+ Windows platforms with a version of Python that can read the
584
+ registry. Returns the same thing as
585
+ SCons.Util.RegQueryValueEx, except you just specify the entire
586
+ path to the value, and don't have to bother opening the key
587
+ first. So:
588
+
589
+ Instead of:
590
+ k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
591
+ r'SOFTWARE\Microsoft\Windows\CurrentVersion')
592
+ out = SCons.Util.RegQueryValueEx(k,
593
+ 'ProgramFilesDir')
594
+
595
+ You can write:
596
+ out = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE,
597
+ r'SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir')
598
+ """
599
+ # I would use os.path.split here, but it's not a filesystem
600
+ # path...
601
+ p = key.rfind('\\') + 1
602
+ keyp = key[:p-1] # -1 to omit trailing slash
603
+ val = key[p:]
604
+ k = RegOpenKeyEx(root, keyp)
605
+ return RegQueryValueEx(k,val)
606
+ else:
607
+ try:
608
+ e = WindowsError
609
+ except NameError:
610
+ # Make sure we have a definition of WindowsError so we can
611
+ # run platform-independent tests of Windows functionality on
612
+ # platforms other than Windows. (WindowsError is, in fact, an
613
+ # OSError subclass on Windows.)
614
+ class WindowsError(OSError):
615
+ pass
616
+ import builtins
617
+ builtins.WindowsError = WindowsError
618
+ else:
619
+ del e
620
+
621
+ HKEY_CLASSES_ROOT = None
622
+ HKEY_LOCAL_MACHINE = None
623
+ HKEY_CURRENT_USER = None
624
+ HKEY_USERS = None
625
+
626
+ def RegGetValue(root, key):
627
+ raise WindowsError
628
+
629
+ def RegOpenKeyEx(root, key):
630
+ raise WindowsError
631
+
632
+ if sys.platform == 'win32':
633
+
634
+ def WhereIs(file, path=None, pathext=None, reject=[]):
635
+ if path is None:
636
+ try:
637
+ path = os.environ['PATH']
638
+ except KeyError:
639
+ return None
640
+ if is_String(path):
641
+ path = path.split(os.pathsep)
642
+ if pathext is None:
643
+ try:
644
+ pathext = os.environ['PATHEXT']
645
+ except KeyError:
646
+ pathext = '.COM;.EXE;.BAT;.CMD'
647
+ if is_String(pathext):
648
+ pathext = pathext.split(os.pathsep)
649
+ for ext in pathext:
650
+ if ext.lower() == file[-len(ext):].lower():
651
+ pathext = ['']
652
+ break
653
+ if not is_List(reject) and not is_Tuple(reject):
654
+ reject = [reject]
655
+ for dir in path:
656
+ f = os.path.join(dir, file)
657
+ for ext in pathext:
658
+ fext = f + ext
659
+ if os.path.isfile(fext):
660
+ try:
661
+ reject.index(fext)
662
+ except ValueError:
663
+ return os.path.normpath(fext)
664
+ continue
665
+ return None
666
+
667
+ elif os.name == 'os2':
668
+
669
+ def WhereIs(file, path=None, pathext=None, reject=[]):
670
+ if path is None:
671
+ try:
672
+ path = os.environ['PATH']
673
+ except KeyError:
674
+ return None
675
+ if is_String(path):
676
+ path = path.split(os.pathsep)
677
+ if pathext is None:
678
+ pathext = ['.exe', '.cmd']
679
+ for ext in pathext:
680
+ if ext.lower() == file[-len(ext):].lower():
681
+ pathext = ['']
682
+ break
683
+ if not is_List(reject) and not is_Tuple(reject):
684
+ reject = [reject]
685
+ for dir in path:
686
+ f = os.path.join(dir, file)
687
+ for ext in pathext:
688
+ fext = f + ext
689
+ if os.path.isfile(fext):
690
+ try:
691
+ reject.index(fext)
692
+ except ValueError:
693
+ return os.path.normpath(fext)
694
+ continue
695
+ return None
696
+
697
+ else:
698
+
699
+ def WhereIs(file, path=None, pathext=None, reject=[]):
700
+ import stat
701
+ if path is None:
702
+ try:
703
+ path = os.environ['PATH']
704
+ except KeyError:
705
+ return None
706
+ if is_String(path):
707
+ path = path.split(os.pathsep)
708
+ if not is_List(reject) and not is_Tuple(reject):
709
+ reject = [reject]
710
+ for d in path:
711
+ f = os.path.join(d, file)
712
+ if os.path.isfile(f):
713
+ try:
714
+ st = os.stat(f)
715
+ except OSError:
716
+ # os.stat() raises OSError, not IOError if the file
717
+ # doesn't exist, so in this case we let IOError get
718
+ # raised so as to not mask possibly serious disk or
719
+ # network issues.
720
+ continue
721
+ if stat.S_IMODE(st[stat.ST_MODE]) & 0111:
722
+ try:
723
+ reject.index(f)
724
+ except ValueError:
725
+ return os.path.normpath(f)
726
+ continue
727
+ return None
728
+
729
+ def PrependPath(oldpath, newpath, sep = os.pathsep,
730
+ delete_existing=1, canonicalize=None):
731
+ """This prepends newpath elements to the given oldpath. Will only
732
+ add any particular path once (leaving the first one it encounters
733
+ and ignoring the rest, to preserve path order), and will
734
+ os.path.normpath and os.path.normcase all paths to help assure
735
+ this. This can also handle the case where the given old path
736
+ variable is a list instead of a string, in which case a list will
737
+ be returned instead of a string.
738
+
739
+ Example:
740
+ Old Path: "/foo/bar:/foo"
741
+ New Path: "/biz/boom:/foo"
742
+ Result: "/biz/boom:/foo:/foo/bar"
743
+
744
+ If delete_existing is 0, then adding a path that exists will
745
+ not move it to the beginning; it will stay where it is in the
746
+ list.
747
+
748
+ If canonicalize is not None, it is applied to each element of
749
+ newpath before use.
750
+ """
751
+
752
+ orig = oldpath
753
+ is_list = 1
754
+ paths = orig
755
+ if not is_List(orig) and not is_Tuple(orig):
756
+ paths = paths.split(sep)
757
+ is_list = 0
758
+
759
+ if is_String(newpath):
760
+ newpaths = newpath.split(sep)
761
+ elif not is_List(newpath) and not is_Tuple(newpath):
762
+ newpaths = [ newpath ] # might be a Dir
763
+ else:
764
+ newpaths = newpath
765
+
766
+ if canonicalize:
767
+ newpaths=list(map(canonicalize, newpaths))
768
+
769
+ if not delete_existing:
770
+ # First uniquify the old paths, making sure to
771
+ # preserve the first instance (in Unix/Linux,
772
+ # the first one wins), and remembering them in normpaths.
773
+ # Then insert the new paths at the head of the list
774
+ # if they're not already in the normpaths list.
775
+ result = []
776
+ normpaths = []
777
+ for path in paths:
778
+ if not path:
779
+ continue
780
+ normpath = os.path.normpath(os.path.normcase(path))
781
+ if normpath not in normpaths:
782
+ result.append(path)
783
+ normpaths.append(normpath)
784
+ newpaths.reverse() # since we're inserting at the head
785
+ for path in newpaths:
786
+ if not path:
787
+ continue
788
+ normpath = os.path.normpath(os.path.normcase(path))
789
+ if normpath not in normpaths:
790
+ result.insert(0, path)
791
+ normpaths.append(normpath)
792
+ paths = result
793
+
794
+ else:
795
+ newpaths = newpaths + paths # prepend new paths
796
+
797
+ normpaths = []
798
+ paths = []
799
+ # now we add them only if they are unique
800
+ for path in newpaths:
801
+ normpath = os.path.normpath(os.path.normcase(path))
802
+ if path and not normpath in normpaths:
803
+ paths.append(path)
804
+ normpaths.append(normpath)
805
+
806
+ if is_list:
807
+ return paths
808
+ else:
809
+ return sep.join(paths)
810
+
811
+ def AppendPath(oldpath, newpath, sep = os.pathsep,
812
+ delete_existing=1, canonicalize=None):
813
+ """This appends new path elements to the given old path. Will
814
+ only add any particular path once (leaving the last one it
815
+ encounters and ignoring the rest, to preserve path order), and
816
+ will os.path.normpath and os.path.normcase all paths to help
817
+ assure this. This can also handle the case where the given old
818
+ path variable is a list instead of a string, in which case a list
819
+ will be returned instead of a string.
820
+
821
+ Example:
822
+ Old Path: "/foo/bar:/foo"
823
+ New Path: "/biz/boom:/foo"
824
+ Result: "/foo/bar:/biz/boom:/foo"
825
+
826
+ If delete_existing is 0, then adding a path that exists
827
+ will not move it to the end; it will stay where it is in the list.
828
+
829
+ If canonicalize is not None, it is applied to each element of
830
+ newpath before use.
831
+ """
832
+
833
+ orig = oldpath
834
+ is_list = 1
835
+ paths = orig
836
+ if not is_List(orig) and not is_Tuple(orig):
837
+ paths = paths.split(sep)
838
+ is_list = 0
839
+
840
+ if is_String(newpath):
841
+ newpaths = newpath.split(sep)
842
+ elif not is_List(newpath) and not is_Tuple(newpath):
843
+ newpaths = [ newpath ] # might be a Dir
844
+ else:
845
+ newpaths = newpath
846
+
847
+ if canonicalize:
848
+ newpaths=list(map(canonicalize, newpaths))
849
+
850
+ if not delete_existing:
851
+ # add old paths to result, then
852
+ # add new paths if not already present
853
+ # (I thought about using a dict for normpaths for speed,
854
+ # but it's not clear hashing the strings would be faster
855
+ # than linear searching these typically short lists.)
856
+ result = []
857
+ normpaths = []
858
+ for path in paths:
859
+ if not path:
860
+ continue
861
+ result.append(path)
862
+ normpaths.append(os.path.normpath(os.path.normcase(path)))
863
+ for path in newpaths:
864
+ if not path:
865
+ continue
866
+ normpath = os.path.normpath(os.path.normcase(path))
867
+ if normpath not in normpaths:
868
+ result.append(path)
869
+ normpaths.append(normpath)
870
+ paths = result
871
+ else:
872
+ # start w/ new paths, add old ones if not present,
873
+ # then reverse.
874
+ newpaths = paths + newpaths # append new paths
875
+ newpaths.reverse()
876
+
877
+ normpaths = []
878
+ paths = []
879
+ # now we add them only if they are unique
880
+ for path in newpaths:
881
+ normpath = os.path.normpath(os.path.normcase(path))
882
+ if path and not normpath in normpaths:
883
+ paths.append(path)
884
+ normpaths.append(normpath)
885
+ paths.reverse()
886
+
887
+ if is_list:
888
+ return paths
889
+ else:
890
+ return sep.join(paths)
891
+
892
+ if sys.platform == 'cygwin':
893
+ def get_native_path(path):
894
+ """Transforms an absolute path into a native path for the system. In
895
+ Cygwin, this converts from a Cygwin path to a Windows one."""
896
+ return os.popen('cygpath -w ' + path).read().replace('\n', '')
897
+ else:
898
+ def get_native_path(path):
899
+ """Transforms an absolute path into a native path for the system.
900
+ Non-Cygwin version, just leave the path alone."""
901
+ return path
902
+
903
+ display = DisplayEngine()
904
+
905
+ def Split(arg):
906
+ if is_List(arg) or is_Tuple(arg):
907
+ return arg
908
+ elif is_String(arg):
909
+ return arg.split()
910
+ else:
911
+ return [arg]
912
+
913
+ class CLVar(UserList):
914
+ """A class for command-line construction variables.
915
+
916
+ This is a list that uses Split() to split an initial string along
917
+ white-space arguments, and similarly to split any strings that get
918
+ added. This allows us to Do the Right Thing with Append() and
919
+ Prepend() (as well as straight Python foo = env['VAR'] + 'arg1
920
+ arg2') regardless of whether a user adds a list or a string to a
921
+ command-line construction variable.
922
+ """
923
+ def __init__(self, seq = []):
924
+ UserList.__init__(self, Split(seq))
925
+ def __add__(self, other):
926
+ return UserList.__add__(self, CLVar(other))
927
+ def __radd__(self, other):
928
+ return UserList.__radd__(self, CLVar(other))
929
+ def __coerce__(self, other):
930
+ return (self, CLVar(other))
931
+ def __str__(self):
932
+ return ' '.join(self.data)
933
+
934
+ # A dictionary that preserves the order in which items are added.
935
+ # Submitted by David Benjamin to ActiveState's Python Cookbook web site:
936
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747
937
+ # Including fixes/enhancements from the follow-on discussions.
938
+ class OrderedDict(UserDict):
939
+ def __init__(self, dict = None):
940
+ self._keys = []
941
+ UserDict.__init__(self, dict)
942
+
943
+ def __delitem__(self, key):
944
+ UserDict.__delitem__(self, key)
945
+ self._keys.remove(key)
946
+
947
+ def __setitem__(self, key, item):
948
+ UserDict.__setitem__(self, key, item)
949
+ if key not in self._keys: self._keys.append(key)
950
+
951
+ def clear(self):
952
+ UserDict.clear(self)
953
+ self._keys = []
954
+
955
+ def copy(self):
956
+ dict = OrderedDict()
957
+ dict.update(self)
958
+ return dict
959
+
960
+ def items(self):
961
+ return list(zip(self._keys, list(self.values())))
962
+
963
+ def keys(self):
964
+ return self._keys[:]
965
+
966
+ def popitem(self):
967
+ try:
968
+ key = self._keys[-1]
969
+ except IndexError:
970
+ raise KeyError('dictionary is empty')
971
+
972
+ val = self[key]
973
+ del self[key]
974
+
975
+ return (key, val)
976
+
977
+ def setdefault(self, key, failobj = None):
978
+ UserDict.setdefault(self, key, failobj)
979
+ if key not in self._keys: self._keys.append(key)
980
+
981
+ def update(self, dict):
982
+ for (key, val) in dict.items():
983
+ self.__setitem__(key, val)
984
+
985
+ def values(self):
986
+ return list(map(self.get, self._keys))
987
+
988
+ class Selector(OrderedDict):
989
+ """A callable ordered dictionary that maps file suffixes to
990
+ dictionary values. We preserve the order in which items are added
991
+ so that get_suffix() calls always return the first suffix added."""
992
+ def __call__(self, env, source, ext=None):
993
+ if ext is None:
994
+ try:
995
+ ext = source[0].suffix
996
+ except IndexError:
997
+ ext = ""
998
+ try:
999
+ return self[ext]
1000
+ except KeyError:
1001
+ # Try to perform Environment substitution on the keys of
1002
+ # the dictionary before giving up.
1003
+ s_dict = {}
1004
+ for (k,v) in self.items():
1005
+ if k is not None:
1006
+ s_k = env.subst(k)
1007
+ if s_k in s_dict:
1008
+ # We only raise an error when variables point
1009
+ # to the same suffix. If one suffix is literal
1010
+ # and a variable suffix contains this literal,
1011
+ # the literal wins and we don't raise an error.
1012
+ raise KeyError(s_dict[s_k][0], k, s_k)
1013
+ s_dict[s_k] = (k,v)
1014
+ try:
1015
+ return s_dict[ext][1]
1016
+ except KeyError:
1017
+ try:
1018
+ return self[None]
1019
+ except KeyError:
1020
+ return None
1021
+
1022
+
1023
+ if sys.platform == 'cygwin':
1024
+ # On Cygwin, os.path.normcase() lies, so just report back the
1025
+ # fact that the underlying Windows OS is case-insensitive.
1026
+ def case_sensitive_suffixes(s1, s2):
1027
+ return 0
1028
+ else:
1029
+ def case_sensitive_suffixes(s1, s2):
1030
+ return (os.path.normcase(s1) != os.path.normcase(s2))
1031
+
1032
+ def adjustixes(fname, pre, suf, ensure_suffix=False):
1033
+ if pre:
1034
+ path, fn = os.path.split(os.path.normpath(fname))
1035
+ if fn[:len(pre)] != pre:
1036
+ fname = os.path.join(path, pre + fn)
1037
+ # Only append a suffix if the suffix we're going to add isn't already
1038
+ # there, and if either we've been asked to ensure the specific suffix
1039
+ # is present or there's no suffix on it at all.
1040
+ if suf and fname[-len(suf):] != suf and \
1041
+ (ensure_suffix or not splitext(fname)[1]):
1042
+ fname = fname + suf
1043
+ return fname
1044
+
1045
+
1046
+
1047
+ # From Tim Peters,
1048
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
1049
+ # ASPN: Python Cookbook: Remove duplicates from a sequence
1050
+ # (Also in the printed Python Cookbook.)
1051
+
1052
+ def unique(s):
1053
+ """Return a list of the elements in s, but without duplicates.
1054
+
1055
+ For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
1056
+ unique("abcabc") some permutation of ["a", "b", "c"], and
1057
+ unique(([1, 2], [2, 3], [1, 2])) some permutation of
1058
+ [[2, 3], [1, 2]].
1059
+
1060
+ For best speed, all sequence elements should be hashable. Then
1061
+ unique() will usually work in linear time.
1062
+
1063
+ If not possible, the sequence elements should enjoy a total
1064
+ ordering, and if list(s).sort() doesn't raise TypeError it's
1065
+ assumed that they do enjoy a total ordering. Then unique() will
1066
+ usually work in O(N*log2(N)) time.
1067
+
1068
+ If that's not possible either, the sequence elements must support
1069
+ equality-testing. Then unique() will usually work in quadratic
1070
+ time.
1071
+ """
1072
+
1073
+ n = len(s)
1074
+ if n == 0:
1075
+ return []
1076
+
1077
+ # Try using a dict first, as that's the fastest and will usually
1078
+ # work. If it doesn't work, it will usually fail quickly, so it
1079
+ # usually doesn't cost much to *try* it. It requires that all the
1080
+ # sequence elements be hashable, and support equality comparison.
1081
+ u = {}
1082
+ try:
1083
+ for x in s:
1084
+ u[x] = 1
1085
+ except TypeError:
1086
+ pass # move on to the next method
1087
+ else:
1088
+ return list(u.keys())
1089
+ del u
1090
+
1091
+ # We can't hash all the elements. Second fastest is to sort,
1092
+ # which brings the equal elements together; then duplicates are
1093
+ # easy to weed out in a single pass.
1094
+ # NOTE: Python's list.sort() was designed to be efficient in the
1095
+ # presence of many duplicate elements. This isn't true of all
1096
+ # sort functions in all languages or libraries, so this approach
1097
+ # is more effective in Python than it may be elsewhere.
1098
+ try:
1099
+ t = sorted(s)
1100
+ except TypeError:
1101
+ pass # move on to the next method
1102
+ else:
1103
+ assert n > 0
1104
+ last = t[0]
1105
+ lasti = i = 1
1106
+ while i < n:
1107
+ if t[i] != last:
1108
+ t[lasti] = last = t[i]
1109
+ lasti = lasti + 1
1110
+ i = i + 1
1111
+ return t[:lasti]
1112
+ del t
1113
+
1114
+ # Brute force is all that's left.
1115
+ u = []
1116
+ for x in s:
1117
+ if x not in u:
1118
+ u.append(x)
1119
+ return u
1120
+
1121
+
1122
+
1123
+ # From Alex Martelli,
1124
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
1125
+ # ASPN: Python Cookbook: Remove duplicates from a sequence
1126
+ # First comment, dated 2001/10/13.
1127
+ # (Also in the printed Python Cookbook.)
1128
+
1129
+ def uniquer(seq, idfun=None):
1130
+ if idfun is None:
1131
+ def idfun(x): return x
1132
+ seen = {}
1133
+ result = []
1134
+ for item in seq:
1135
+ marker = idfun(item)
1136
+ # in old Python versions:
1137
+ # if seen.has_key(marker)
1138
+ # but in new ones:
1139
+ if marker in seen: continue
1140
+ seen[marker] = 1
1141
+ result.append(item)
1142
+ return result
1143
+
1144
+ # A more efficient implementation of Alex's uniquer(), this avoids the
1145
+ # idfun() argument and function-call overhead by assuming that all
1146
+ # items in the sequence are hashable.
1147
+
1148
+ def uniquer_hashables(seq):
1149
+ seen = {}
1150
+ result = []
1151
+ for item in seq:
1152
+ #if not item in seen:
1153
+ if item not in seen:
1154
+ seen[item] = 1
1155
+ result.append(item)
1156
+ return result
1157
+
1158
+
1159
+
1160
+ # Much of the logic here was originally based on recipe 4.9 from the
1161
+ # Python CookBook, but we had to dumb it way down for Python 1.5.2.
1162
+ class LogicalLines(object):
1163
+
1164
+ def __init__(self, fileobj):
1165
+ self.fileobj = fileobj
1166
+
1167
+ def readline(self):
1168
+ result = []
1169
+ while True:
1170
+ line = self.fileobj.readline()
1171
+ if not line:
1172
+ break
1173
+ if line[-2:] == '\\\n':
1174
+ result.append(line[:-2])
1175
+ else:
1176
+ result.append(line)
1177
+ break
1178
+ return ''.join(result)
1179
+
1180
+ def readlines(self):
1181
+ result = []
1182
+ while True:
1183
+ line = self.readline()
1184
+ if not line:
1185
+ break
1186
+ result.append(line)
1187
+ return result
1188
+
1189
+
1190
+
1191
+ class UniqueList(UserList):
1192
+ def __init__(self, seq = []):
1193
+ UserList.__init__(self, seq)
1194
+ self.unique = True
1195
+ def __make_unique(self):
1196
+ if not self.unique:
1197
+ self.data = uniquer_hashables(self.data)
1198
+ self.unique = True
1199
+ def __lt__(self, other):
1200
+ self.__make_unique()
1201
+ return UserList.__lt__(self, other)
1202
+ def __le__(self, other):
1203
+ self.__make_unique()
1204
+ return UserList.__le__(self, other)
1205
+ def __eq__(self, other):
1206
+ self.__make_unique()
1207
+ return UserList.__eq__(self, other)
1208
+ def __ne__(self, other):
1209
+ self.__make_unique()
1210
+ return UserList.__ne__(self, other)
1211
+ def __gt__(self, other):
1212
+ self.__make_unique()
1213
+ return UserList.__gt__(self, other)
1214
+ def __ge__(self, other):
1215
+ self.__make_unique()
1216
+ return UserList.__ge__(self, other)
1217
+ def __cmp__(self, other):
1218
+ self.__make_unique()
1219
+ return UserList.__cmp__(self, other)
1220
+ def __len__(self):
1221
+ self.__make_unique()
1222
+ return UserList.__len__(self)
1223
+ def __getitem__(self, i):
1224
+ self.__make_unique()
1225
+ return UserList.__getitem__(self, i)
1226
+ def __setitem__(self, i, item):
1227
+ UserList.__setitem__(self, i, item)
1228
+ self.unique = False
1229
+ def __getslice__(self, i, j):
1230
+ self.__make_unique()
1231
+ return UserList.__getslice__(self, i, j)
1232
+ def __setslice__(self, i, j, other):
1233
+ UserList.__setslice__(self, i, j, other)
1234
+ self.unique = False
1235
+ def __add__(self, other):
1236
+ result = UserList.__add__(self, other)
1237
+ result.unique = False
1238
+ return result
1239
+ def __radd__(self, other):
1240
+ result = UserList.__radd__(self, other)
1241
+ result.unique = False
1242
+ return result
1243
+ def __iadd__(self, other):
1244
+ result = UserList.__iadd__(self, other)
1245
+ result.unique = False
1246
+ return result
1247
+ def __mul__(self, other):
1248
+ result = UserList.__mul__(self, other)
1249
+ result.unique = False
1250
+ return result
1251
+ def __rmul__(self, other):
1252
+ result = UserList.__rmul__(self, other)
1253
+ result.unique = False
1254
+ return result
1255
+ def __imul__(self, other):
1256
+ result = UserList.__imul__(self, other)
1257
+ result.unique = False
1258
+ return result
1259
+ def append(self, item):
1260
+ UserList.append(self, item)
1261
+ self.unique = False
1262
+ def insert(self, i):
1263
+ UserList.insert(self, i)
1264
+ self.unique = False
1265
+ def count(self, item):
1266
+ self.__make_unique()
1267
+ return UserList.count(self, item)
1268
+ def index(self, item):
1269
+ self.__make_unique()
1270
+ return UserList.index(self, item)
1271
+ def reverse(self):
1272
+ self.__make_unique()
1273
+ UserList.reverse(self)
1274
+ def sort(self, *args, **kwds):
1275
+ self.__make_unique()
1276
+ return UserList.sort(self, *args, **kwds)
1277
+ def extend(self, other):
1278
+ UserList.extend(self, other)
1279
+ self.unique = False
1280
+
1281
+
1282
+ class Unbuffered(object):
1283
+ """
1284
+ A proxy class that wraps a file object, flushing after every write,
1285
+ and delegating everything else to the wrapped object.
1286
+ """
1287
+ def __init__(self, file):
1288
+ self.file = file
1289
+ self.softspace = 0 ## backward compatibility; not supported in Py3k
1290
+ def write(self, arg):
1291
+ try:
1292
+ self.file.write(arg)
1293
+ self.file.flush()
1294
+ except IOError:
1295
+ # Stdout might be connected to a pipe that has been closed
1296
+ # by now. The most likely reason for the pipe being closed
1297
+ # is that the user has press ctrl-c. It this is the case,
1298
+ # then SCons is currently shutdown. We therefore ignore
1299
+ # IOError's here so that SCons can continue and shutdown
1300
+ # properly so that the .sconsign is correctly written
1301
+ # before SCons exits.
1302
+ pass
1303
+ def __getattr__(self, attr):
1304
+ return getattr(self.file, attr)
1305
+
1306
+ def make_path_relative(path):
1307
+ """ makes an absolute path name to a relative pathname.
1308
+ """
1309
+ if os.path.isabs(path):
1310
+ drive_s,path = os.path.splitdrive(path)
1311
+
1312
+ import re
1313
+ if not drive_s:
1314
+ path=re.compile("/*(.*)").findall(path)[0]
1315
+ else:
1316
+ path=path[1:]
1317
+
1318
+ assert( not os.path.isabs( path ) ), path
1319
+ return path
1320
+
1321
+
1322
+
1323
+ # The original idea for AddMethod() and RenameFunction() come from the
1324
+ # following post to the ActiveState Python Cookbook:
1325
+ #
1326
+ # ASPN: Python Cookbook : Install bound methods in an instance
1327
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223613
1328
+ #
1329
+ # That code was a little fragile, though, so the following changes
1330
+ # have been wrung on it:
1331
+ #
1332
+ # * Switched the installmethod() "object" and "function" arguments,
1333
+ # so the order reflects that the left-hand side is the thing being
1334
+ # "assigned to" and the right-hand side is the value being assigned.
1335
+ #
1336
+ # * Changed explicit type-checking to the "try: klass = object.__class__"
1337
+ # block in installmethod() below so that it still works with the
1338
+ # old-style classes that SCons uses.
1339
+ #
1340
+ # * Replaced the by-hand creation of methods and functions with use of
1341
+ # the "new" module, as alluded to in Alex Martelli's response to the
1342
+ # following Cookbook post:
1343
+ #
1344
+ # ASPN: Python Cookbook : Dynamically added methods to a class
1345
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81732
1346
+
1347
+ def AddMethod(obj, function, name=None):
1348
+ """
1349
+ Adds either a bound method to an instance or an unbound method to
1350
+ a class. If name is ommited the name of the specified function
1351
+ is used by default.
1352
+ Example:
1353
+ a = A()
1354
+ def f(self, x, y):
1355
+ self.z = x + y
1356
+ AddMethod(f, A, "add")
1357
+ a.add(2, 4)
1358
+ print a.z
1359
+ AddMethod(lambda self, i: self.l[i], a, "listIndex")
1360
+ print a.listIndex(5)
1361
+ """
1362
+ if name is None:
1363
+ name = function.func_name
1364
+ else:
1365
+ function = RenameFunction(function, name)
1366
+
1367
+ if hasattr(obj, '__class__') and obj.__class__ is not type:
1368
+ # "obj" is an instance, so it gets a bound method.
1369
+ setattr(obj, name, MethodType(function, obj, obj.__class__))
1370
+ else:
1371
+ # "obj" is a class, so it gets an unbound method.
1372
+ setattr(obj, name, MethodType(function, None, obj))
1373
+
1374
+ def RenameFunction(function, name):
1375
+ """
1376
+ Returns a function identical to the specified function, but with
1377
+ the specified name.
1378
+ """
1379
+ return FunctionType(function.func_code,
1380
+ function.func_globals,
1381
+ name,
1382
+ function.func_defaults)
1383
+
1384
+
1385
+ md5 = False
1386
+ def MD5signature(s):
1387
+ return str(s)
1388
+
1389
+ def MD5filesignature(fname, chunksize=65536):
1390
+ f = open(fname, "rb")
1391
+ result = f.read()
1392
+ f.close()
1393
+ return result
1394
+
1395
+ try:
1396
+ import hashlib
1397
+ except ImportError:
1398
+ pass
1399
+ else:
1400
+ if hasattr(hashlib, 'md5'):
1401
+ md5 = True
1402
+ def MD5signature(s):
1403
+ m = hashlib.md5()
1404
+ m.update(str(s))
1405
+ return m.hexdigest()
1406
+
1407
+ def MD5filesignature(fname, chunksize=65536):
1408
+ m = hashlib.md5()
1409
+ f = open(fname, "rb")
1410
+ while True:
1411
+ blck = f.read(chunksize)
1412
+ if not blck:
1413
+ break
1414
+ m.update(str(blck))
1415
+ f.close()
1416
+ return m.hexdigest()
1417
+
1418
+ def MD5collect(signatures):
1419
+ """
1420
+ Collects a list of signatures into an aggregate signature.
1421
+
1422
+ signatures - a list of signatures
1423
+ returns - the aggregate signature
1424
+ """
1425
+ if len(signatures) == 1:
1426
+ return signatures[0]
1427
+ else:
1428
+ return MD5signature(', '.join(signatures))
1429
+
1430
+
1431
+
1432
+ def silent_intern(x):
1433
+ """
1434
+ Perform sys.intern() on the passed argument and return the result.
1435
+ If the input is ineligible (e.g. a unicode string) the original argument is
1436
+ returned and no exception is thrown.
1437
+ """
1438
+ try:
1439
+ return sys.intern(x)
1440
+ except TypeError:
1441
+ return x
1442
+
1443
+
1444
+
1445
+ # From Dinu C. Gherman,
1446
+ # Python Cookbook, second edition, recipe 6.17, p. 277.
1447
+ # Also:
1448
+ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205
1449
+ # ASPN: Python Cookbook: Null Object Design Pattern
1450
+
1451
+ #TODO??? class Null(object):
1452
+ class Null(object):
1453
+ """ Null objects always and reliably "do nothing." """
1454
+ def __new__(cls, *args, **kwargs):
1455
+ if not '_instance' in vars(cls):
1456
+ cls._instance = super(Null, cls).__new__(cls, *args, **kwargs)
1457
+ return cls._instance
1458
+ def __init__(self, *args, **kwargs):
1459
+ pass
1460
+ def __call__(self, *args, **kwargs):
1461
+ return self
1462
+ def __repr__(self):
1463
+ return "Null(0x%08X)" % id(self)
1464
+ def __nonzero__(self):
1465
+ return False
1466
+ def __getattr__(self, name):
1467
+ return self
1468
+ def __setattr__(self, name, value):
1469
+ return self
1470
+ def __delattr__(self, name):
1471
+ return self
1472
+
1473
+ class NullSeq(Null):
1474
+ def __len__(self):
1475
+ return 0
1476
+ def __iter__(self):
1477
+ return iter(())
1478
+ def __getitem__(self, i):
1479
+ return self
1480
+ def __delitem__(self, i):
1481
+ return self
1482
+ def __setitem__(self, i, v):
1483
+ return self
1484
+
1485
+
1486
+ del __revision__
1487
+
1488
+ # Local Variables:
1489
+ # tab-width:4
1490
+ # indent-tabs-mode:nil
1491
+ # End:
1492
+ # vim: set expandtab tabstop=4 shiftwidth=4: