libv8 3.3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,1281 @@
1
+ # subprocess - Subprocesses with accessible I/O streams
2
+ #
3
+ # For more information about this module, see PEP 324.
4
+ #
5
+ # This module should remain compatible with Python 2.2, see PEP 291.
6
+ #
7
+ # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
8
+ #
9
+ # Licensed to PSF under a Contributor Agreement.
10
+ # See http://www.python.org/2.4/license for licensing details.
11
+
12
+ r"""subprocess - Subprocesses with accessible I/O streams
13
+
14
+ This module allows you to spawn processes, connect to their
15
+ input/output/error pipes, and obtain their return codes. This module
16
+ intends to replace several other, older modules and functions, like:
17
+
18
+ os.system
19
+ os.spawn*
20
+ os.popen*
21
+ popen2.*
22
+ commands.*
23
+
24
+ Information about how the subprocess module can be used to replace these
25
+ modules and functions can be found below.
26
+
27
+
28
+
29
+ Using the subprocess module
30
+ ===========================
31
+ This module defines one class called Popen:
32
+
33
+ class Popen(args, bufsize=0, executable=None,
34
+ stdin=None, stdout=None, stderr=None,
35
+ preexec_fn=None, close_fds=False, shell=False,
36
+ cwd=None, env=None, universal_newlines=False,
37
+ startupinfo=None, creationflags=0):
38
+
39
+
40
+ Arguments are:
41
+
42
+ args should be a string, or a sequence of program arguments. The
43
+ program to execute is normally the first item in the args sequence or
44
+ string, but can be explicitly set by using the executable argument.
45
+
46
+ On UNIX, with shell=False (default): In this case, the Popen class
47
+ uses os.execvp() to execute the child program. args should normally
48
+ be a sequence. A string will be treated as a sequence with the string
49
+ as the only item (the program to execute).
50
+
51
+ On UNIX, with shell=True: If args is a string, it specifies the
52
+ command string to execute through the shell. If args is a sequence,
53
+ the first item specifies the command string, and any additional items
54
+ will be treated as additional shell arguments.
55
+
56
+ On Windows: the Popen class uses CreateProcess() to execute the child
57
+ program, which operates on strings. If args is a sequence, it will be
58
+ converted to a string using the list2cmdline method. Please note that
59
+ not all MS Windows applications interpret the command line the same
60
+ way: The list2cmdline is designed for applications using the same
61
+ rules as the MS C runtime.
62
+
63
+ bufsize, if given, has the same meaning as the corresponding argument
64
+ to the built-in open() function: 0 means unbuffered, 1 means line
65
+ buffered, any other positive value means use a buffer of
66
+ (approximately) that size. A negative bufsize means to use the system
67
+ default, which usually means fully buffered. The default value for
68
+ bufsize is 0 (unbuffered).
69
+
70
+ stdin, stdout and stderr specify the executed programs' standard
71
+ input, standard output and standard error file handles, respectively.
72
+ Valid values are PIPE, an existing file descriptor (a positive
73
+ integer), an existing file object, and None. PIPE indicates that a
74
+ new pipe to the child should be created. With None, no redirection
75
+ will occur; the child's file handles will be inherited from the
76
+ parent. Additionally, stderr can be STDOUT, which indicates that the
77
+ stderr data from the applications should be captured into the same
78
+ file handle as for stdout.
79
+
80
+ If preexec_fn is set to a callable object, this object will be called
81
+ in the child process just before the child is executed.
82
+
83
+ If close_fds is true, all file descriptors except 0, 1 and 2 will be
84
+ closed before the child process is executed.
85
+
86
+ if shell is true, the specified command will be executed through the
87
+ shell.
88
+
89
+ If cwd is not None, the current directory will be changed to cwd
90
+ before the child is executed.
91
+
92
+ If env is not None, it defines the environment variables for the new
93
+ process.
94
+
95
+ If universal_newlines is true, the file objects stdout and stderr are
96
+ opened as a text files, but lines may be terminated by any of '\n',
97
+ the Unix end-of-line convention, '\r', the Macintosh convention or
98
+ '\r\n', the Windows convention. All of these external representations
99
+ are seen as '\n' by the Python program. Note: This feature is only
100
+ available if Python is built with universal newline support (the
101
+ default). Also, the newlines attribute of the file objects stdout,
102
+ stdin and stderr are not updated by the communicate() method.
103
+
104
+ The startupinfo and creationflags, if given, will be passed to the
105
+ underlying CreateProcess() function. They can specify things such as
106
+ appearance of the main window and priority for the new process.
107
+ (Windows only)
108
+
109
+
110
+ This module also defines two shortcut functions:
111
+
112
+ call(*popenargs, **kwargs):
113
+ Run command with arguments. Wait for command to complete, then
114
+ return the returncode attribute.
115
+
116
+ The arguments are the same as for the Popen constructor. Example:
117
+
118
+ retcode = call(["ls", "-l"])
119
+
120
+ check_call(*popenargs, **kwargs):
121
+ Run command with arguments. Wait for command to complete. If the
122
+ exit code was zero then return, otherwise raise
123
+ CalledProcessError. The CalledProcessError object will have the
124
+ return code in the returncode attribute.
125
+
126
+ The arguments are the same as for the Popen constructor. Example:
127
+
128
+ check_call(["ls", "-l"])
129
+
130
+ Exceptions
131
+ ----------
132
+ Exceptions raised in the child process, before the new program has
133
+ started to execute, will be re-raised in the parent. Additionally,
134
+ the exception object will have one extra attribute called
135
+ 'child_traceback', which is a string containing traceback information
136
+ from the childs point of view.
137
+
138
+ The most common exception raised is OSError. This occurs, for
139
+ example, when trying to execute a non-existent file. Applications
140
+ should prepare for OSErrors.
141
+
142
+ A ValueError will be raised if Popen is called with invalid arguments.
143
+
144
+ check_call() will raise CalledProcessError, if the called process
145
+ returns a non-zero return code.
146
+
147
+
148
+ Security
149
+ --------
150
+ Unlike some other popen functions, this implementation will never call
151
+ /bin/sh implicitly. This means that all characters, including shell
152
+ metacharacters, can safely be passed to child processes.
153
+
154
+
155
+ Popen objects
156
+ =============
157
+ Instances of the Popen class have the following methods:
158
+
159
+ poll()
160
+ Check if child process has terminated. Returns returncode
161
+ attribute.
162
+
163
+ wait()
164
+ Wait for child process to terminate. Returns returncode attribute.
165
+
166
+ communicate(input=None)
167
+ Interact with process: Send data to stdin. Read data from stdout
168
+ and stderr, until end-of-file is reached. Wait for process to
169
+ terminate. The optional stdin argument should be a string to be
170
+ sent to the child process, or None, if no data should be sent to
171
+ the child.
172
+
173
+ communicate() returns a tuple (stdout, stderr).
174
+
175
+ Note: The data read is buffered in memory, so do not use this
176
+ method if the data size is large or unlimited.
177
+
178
+ The following attributes are also available:
179
+
180
+ stdin
181
+ If the stdin argument is PIPE, this attribute is a file object
182
+ that provides input to the child process. Otherwise, it is None.
183
+
184
+ stdout
185
+ If the stdout argument is PIPE, this attribute is a file object
186
+ that provides output from the child process. Otherwise, it is
187
+ None.
188
+
189
+ stderr
190
+ If the stderr argument is PIPE, this attribute is file object that
191
+ provides error output from the child process. Otherwise, it is
192
+ None.
193
+
194
+ pid
195
+ The process ID of the child process.
196
+
197
+ returncode
198
+ The child return code. A None value indicates that the process
199
+ hasn't terminated yet. A negative value -N indicates that the
200
+ child was terminated by signal N (UNIX only).
201
+
202
+
203
+ Replacing older functions with the subprocess module
204
+ ====================================================
205
+ In this section, "a ==> b" means that b can be used as a replacement
206
+ for a.
207
+
208
+ Note: All functions in this section fail (more or less) silently if
209
+ the executed program cannot be found; this module raises an OSError
210
+ exception.
211
+
212
+ In the following examples, we assume that the subprocess module is
213
+ imported with "from subprocess import *".
214
+
215
+
216
+ Replacing /bin/sh shell backquote
217
+ ---------------------------------
218
+ output=`mycmd myarg`
219
+ ==>
220
+ output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
221
+
222
+
223
+ Replacing shell pipe line
224
+ -------------------------
225
+ output=`dmesg | grep hda`
226
+ ==>
227
+ p1 = Popen(["dmesg"], stdout=PIPE)
228
+ p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
229
+ output = p2.communicate()[0]
230
+
231
+
232
+ Replacing os.system()
233
+ ---------------------
234
+ sts = os.system("mycmd" + " myarg")
235
+ ==>
236
+ p = Popen("mycmd" + " myarg", shell=True)
237
+ pid, sts = os.waitpid(p.pid, 0)
238
+
239
+ Note:
240
+
241
+ * Calling the program through the shell is usually not required.
242
+
243
+ * It's easier to look at the returncode attribute than the
244
+ exitstatus.
245
+
246
+ A more real-world example would look like this:
247
+
248
+ try:
249
+ retcode = call("mycmd" + " myarg", shell=True)
250
+ if retcode < 0:
251
+ print >>sys.stderr, "Child was terminated by signal", -retcode
252
+ else:
253
+ print >>sys.stderr, "Child returned", retcode
254
+ except OSError, e:
255
+ print >>sys.stderr, "Execution failed:", e
256
+
257
+
258
+ Replacing os.spawn*
259
+ -------------------
260
+ P_NOWAIT example:
261
+
262
+ pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")
263
+ ==>
264
+ pid = Popen(["/bin/mycmd", "myarg"]).pid
265
+
266
+
267
+ P_WAIT example:
268
+
269
+ retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg")
270
+ ==>
271
+ retcode = call(["/bin/mycmd", "myarg"])
272
+
273
+
274
+ Vector example:
275
+
276
+ os.spawnvp(os.P_NOWAIT, path, args)
277
+ ==>
278
+ Popen([path] + args[1:])
279
+
280
+
281
+ Environment example:
282
+
283
+ os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env)
284
+ ==>
285
+ Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})
286
+
287
+
288
+ Replacing os.popen*
289
+ -------------------
290
+ pipe = os.popen(cmd, mode='r', bufsize)
291
+ ==>
292
+ pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout
293
+
294
+ pipe = os.popen(cmd, mode='w', bufsize)
295
+ ==>
296
+ pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin
297
+
298
+
299
+ (child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)
300
+ ==>
301
+ p = Popen(cmd, shell=True, bufsize=bufsize,
302
+ stdin=PIPE, stdout=PIPE, close_fds=True)
303
+ (child_stdin, child_stdout) = (p.stdin, p.stdout)
304
+
305
+
306
+ (child_stdin,
307
+ child_stdout,
308
+ child_stderr) = os.popen3(cmd, mode, bufsize)
309
+ ==>
310
+ p = Popen(cmd, shell=True, bufsize=bufsize,
311
+ stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
312
+ (child_stdin,
313
+ child_stdout,
314
+ child_stderr) = (p.stdin, p.stdout, p.stderr)
315
+
316
+
317
+ (child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)
318
+ ==>
319
+ p = Popen(cmd, shell=True, bufsize=bufsize,
320
+ stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
321
+ (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
322
+
323
+
324
+ Replacing popen2.*
325
+ ------------------
326
+ Note: If the cmd argument to popen2 functions is a string, the command
327
+ is executed through /bin/sh. If it is a list, the command is directly
328
+ executed.
329
+
330
+ (child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode)
331
+ ==>
332
+ p = Popen(["somestring"], shell=True, bufsize=bufsize
333
+ stdin=PIPE, stdout=PIPE, close_fds=True)
334
+ (child_stdout, child_stdin) = (p.stdout, p.stdin)
335
+
336
+
337
+ (child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode)
338
+ ==>
339
+ p = Popen(["mycmd", "myarg"], bufsize=bufsize,
340
+ stdin=PIPE, stdout=PIPE, close_fds=True)
341
+ (child_stdout, child_stdin) = (p.stdout, p.stdin)
342
+
343
+ The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen,
344
+ except that:
345
+
346
+ * subprocess.Popen raises an exception if the execution fails
347
+ * the capturestderr argument is replaced with the stderr argument.
348
+ * stdin=PIPE and stdout=PIPE must be specified.
349
+ * popen2 closes all filedescriptors by default, but you have to specify
350
+ close_fds=True with subprocess.Popen.
351
+
352
+
353
+ """
354
+
355
+ import sys
356
+ mswindows = (sys.platform == "win32")
357
+
358
+ import os
359
+ import types
360
+ import traceback
361
+
362
+ # Exception classes used by this module.
363
+ class CalledProcessError(Exception):
364
+ """This exception is raised when a process run by check_call() returns
365
+ a non-zero exit status. The exit status will be stored in the
366
+ returncode attribute."""
367
+ def __init__(self, returncode, cmd):
368
+ self.returncode = returncode
369
+ self.cmd = cmd
370
+ def __str__(self):
371
+ return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
372
+
373
+
374
+ if mswindows:
375
+ try:
376
+ import threading
377
+ except ImportError:
378
+ # SCons: the threading module is only used by the communicate()
379
+ # method, which we don't actually use, so don't worry if we
380
+ # can't import it.
381
+ pass
382
+ import msvcrt
383
+ try:
384
+ # Try to get _subprocess
385
+ from _subprocess import *
386
+ class STARTUPINFO(object):
387
+ dwFlags = 0
388
+ hStdInput = None
389
+ hStdOutput = None
390
+ hStdError = None
391
+ wShowWindow = 0
392
+ class pywintypes(object):
393
+ error = IOError
394
+ except ImportError:
395
+ # If not there, then drop back to requiring pywin32
396
+ # TODO: Should this be wrapped in try as well? To notify user to install
397
+ # pywin32 ? With URL to it?
398
+ import pywintypes
399
+ from win32api import GetStdHandle, STD_INPUT_HANDLE, \
400
+ STD_OUTPUT_HANDLE, STD_ERROR_HANDLE
401
+ from win32api import GetCurrentProcess, DuplicateHandle, \
402
+ GetModuleFileName, GetVersion
403
+ from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE
404
+ from win32pipe import CreatePipe
405
+ from win32process import CreateProcess, STARTUPINFO, \
406
+ GetExitCodeProcess, STARTF_USESTDHANDLES, \
407
+ STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE
408
+ from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0
409
+
410
+
411
+ else:
412
+ import select
413
+ import errno
414
+ import fcntl
415
+ import pickle
416
+
417
+ try:
418
+ fcntl.F_GETFD
419
+ except AttributeError:
420
+ fcntl.F_GETFD = 1
421
+
422
+ try:
423
+ fcntl.F_SETFD
424
+ except AttributeError:
425
+ fcntl.F_SETFD = 2
426
+
427
+ __all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "CalledProcessError"]
428
+
429
+ try:
430
+ MAXFD = os.sysconf("SC_OPEN_MAX")
431
+ except KeyboardInterrupt:
432
+ raise # SCons: don't swallow keyboard interrupts
433
+ except:
434
+ MAXFD = 256
435
+
436
+ try:
437
+ isinstance(1, int)
438
+ except TypeError:
439
+ def is_int(obj):
440
+ return isinstance(obj, type(1))
441
+ def is_int_or_long(obj):
442
+ return type(obj) in (type(1), type(1L))
443
+ else:
444
+ def is_int(obj):
445
+ return isinstance(obj, int)
446
+ def is_int_or_long(obj):
447
+ return isinstance(obj, (int, long))
448
+
449
+ try:
450
+ types.StringTypes
451
+ except AttributeError:
452
+ try:
453
+ types.StringTypes = (str, unicode)
454
+ except NameError:
455
+ types.StringTypes = (str,)
456
+ def is_string(obj):
457
+ return isinstance(obj, types.StringTypes)
458
+
459
+ _active = []
460
+
461
+ def _cleanup():
462
+ for inst in _active[:]:
463
+ if inst.poll(_deadstate=sys.maxsize) >= 0:
464
+ try:
465
+ _active.remove(inst)
466
+ except ValueError:
467
+ # This can happen if two threads create a new Popen instance.
468
+ # It's harmless that it was already removed, so ignore.
469
+ pass
470
+
471
+ PIPE = -1
472
+ STDOUT = -2
473
+
474
+
475
+ def call(*popenargs, **kwargs):
476
+ """Run command with arguments. Wait for command to complete, then
477
+ return the returncode attribute.
478
+
479
+ The arguments are the same as for the Popen constructor. Example:
480
+
481
+ retcode = call(["ls", "-l"])
482
+ """
483
+ return apply(Popen, popenargs, kwargs).wait()
484
+
485
+
486
+ def check_call(*popenargs, **kwargs):
487
+ """Run command with arguments. Wait for command to complete. If
488
+ the exit code was zero then return, otherwise raise
489
+ CalledProcessError. The CalledProcessError object will have the
490
+ return code in the returncode attribute.
491
+
492
+ The arguments are the same as for the Popen constructor. Example:
493
+
494
+ check_call(["ls", "-l"])
495
+ """
496
+ retcode = call(*popenargs, **kwargs)
497
+ cmd = kwargs.get("args")
498
+ if cmd is None:
499
+ cmd = popenargs[0]
500
+ if retcode:
501
+ raise CalledProcessError(retcode, cmd)
502
+ return retcode
503
+
504
+
505
+ def list2cmdline(seq):
506
+ """
507
+ Translate a sequence of arguments into a command line
508
+ string, using the same rules as the MS C runtime:
509
+
510
+ 1) Arguments are delimited by white space, which is either a
511
+ space or a tab.
512
+
513
+ 2) A string surrounded by double quotation marks is
514
+ interpreted as a single argument, regardless of white space
515
+ contained within. A quoted string can be embedded in an
516
+ argument.
517
+
518
+ 3) A double quotation mark preceded by a backslash is
519
+ interpreted as a literal double quotation mark.
520
+
521
+ 4) Backslashes are interpreted literally, unless they
522
+ immediately precede a double quotation mark.
523
+
524
+ 5) If backslashes immediately precede a double quotation mark,
525
+ every pair of backslashes is interpreted as a literal
526
+ backslash. If the number of backslashes is odd, the last
527
+ backslash escapes the next double quotation mark as
528
+ described in rule 3.
529
+ """
530
+
531
+ # See
532
+ # http://msdn.microsoft.com/library/en-us/vccelng/htm/progs_12.asp
533
+ result = []
534
+ needquote = False
535
+ for arg in seq:
536
+ bs_buf = []
537
+
538
+ # Add a space to separate this argument from the others
539
+ if result:
540
+ result.append(' ')
541
+
542
+ needquote = (" " in arg) or ("\t" in arg)
543
+ if needquote:
544
+ result.append('"')
545
+
546
+ for c in arg:
547
+ if c == '\\':
548
+ # Don't know if we need to double yet.
549
+ bs_buf.append(c)
550
+ elif c == '"':
551
+ # Double backspaces.
552
+ result.append('\\' * len(bs_buf)*2)
553
+ bs_buf = []
554
+ result.append('\\"')
555
+ else:
556
+ # Normal char
557
+ if bs_buf:
558
+ result.extend(bs_buf)
559
+ bs_buf = []
560
+ result.append(c)
561
+
562
+ # Add remaining backspaces, if any.
563
+ if bs_buf:
564
+ result.extend(bs_buf)
565
+
566
+ if needquote:
567
+ result.extend(bs_buf)
568
+ result.append('"')
569
+
570
+ return ''.join(result)
571
+
572
+ class Popen(object):
573
+ def __init__(self, args, bufsize=0, executable=None,
574
+ stdin=None, stdout=None, stderr=None,
575
+ preexec_fn=None, close_fds=False, shell=False,
576
+ cwd=None, env=None, universal_newlines=False,
577
+ startupinfo=None, creationflags=0):
578
+ """Create new Popen instance."""
579
+ _cleanup()
580
+
581
+ self._child_created = False
582
+ if not is_int_or_long(bufsize):
583
+ raise TypeError("bufsize must be an integer")
584
+
585
+ if mswindows:
586
+ if preexec_fn is not None:
587
+ raise ValueError("preexec_fn is not supported on Windows "
588
+ "platforms")
589
+ if close_fds:
590
+ raise ValueError("close_fds is not supported on Windows "
591
+ "platforms")
592
+ else:
593
+ # POSIX
594
+ if startupinfo is not None:
595
+ raise ValueError("startupinfo is only supported on Windows "
596
+ "platforms")
597
+ if creationflags != 0:
598
+ raise ValueError("creationflags is only supported on Windows "
599
+ "platforms")
600
+
601
+ self.stdin = None
602
+ self.stdout = None
603
+ self.stderr = None
604
+ self.pid = None
605
+ self.returncode = None
606
+ self.universal_newlines = universal_newlines
607
+
608
+ # Input and output objects. The general principle is like
609
+ # this:
610
+ #
611
+ # Parent Child
612
+ # ------ -----
613
+ # p2cwrite ---stdin---> p2cread
614
+ # c2pread <--stdout--- c2pwrite
615
+ # errread <--stderr--- errwrite
616
+ #
617
+ # On POSIX, the child objects are file descriptors. On
618
+ # Windows, these are Windows file handles. The parent objects
619
+ # are file descriptors on both platforms. The parent objects
620
+ # are None when not using PIPEs. The child objects are None
621
+ # when not redirecting.
622
+
623
+ (p2cread, p2cwrite,
624
+ c2pread, c2pwrite,
625
+ errread, errwrite) = self._get_handles(stdin, stdout, stderr)
626
+
627
+ self._execute_child(args, executable, preexec_fn, close_fds,
628
+ cwd, env, universal_newlines,
629
+ startupinfo, creationflags, shell,
630
+ p2cread, p2cwrite,
631
+ c2pread, c2pwrite,
632
+ errread, errwrite)
633
+
634
+ if p2cwrite:
635
+ self.stdin = os.fdopen(p2cwrite, 'wb', bufsize)
636
+ if c2pread:
637
+ if universal_newlines:
638
+ self.stdout = os.fdopen(c2pread, 'rU', bufsize)
639
+ else:
640
+ self.stdout = os.fdopen(c2pread, 'rb', bufsize)
641
+ if errread:
642
+ if universal_newlines:
643
+ self.stderr = os.fdopen(errread, 'rU', bufsize)
644
+ else:
645
+ self.stderr = os.fdopen(errread, 'rb', bufsize)
646
+
647
+
648
+ def _translate_newlines(self, data):
649
+ data = data.replace("\r\n", "\n")
650
+ data = data.replace("\r", "\n")
651
+ return data
652
+
653
+
654
+ def __del__(self):
655
+ if not self._child_created:
656
+ # We didn't get to successfully create a child process.
657
+ return
658
+ # In case the child hasn't been waited on, check if it's done.
659
+ self.poll(_deadstate=sys.maxsize)
660
+ if self.returncode is None and _active is not None:
661
+ # Child is still running, keep us alive until we can wait on it.
662
+ _active.append(self)
663
+
664
+
665
+ def communicate(self, input=None):
666
+ """Interact with process: Send data to stdin. Read data from
667
+ stdout and stderr, until end-of-file is reached. Wait for
668
+ process to terminate. The optional input argument should be a
669
+ string to be sent to the child process, or None, if no data
670
+ should be sent to the child.
671
+
672
+ communicate() returns a tuple (stdout, stderr)."""
673
+
674
+ # Optimization: If we are only using one pipe, or no pipe at
675
+ # all, using select() or threads is unnecessary.
676
+ if [self.stdin, self.stdout, self.stderr].count(None) >= 2:
677
+ stdout = None
678
+ stderr = None
679
+ if self.stdin:
680
+ if input:
681
+ self.stdin.write(input)
682
+ self.stdin.close()
683
+ elif self.stdout:
684
+ stdout = self.stdout.read()
685
+ elif self.stderr:
686
+ stderr = self.stderr.read()
687
+ self.wait()
688
+ return (stdout, stderr)
689
+
690
+ return self._communicate(input)
691
+
692
+
693
+ if mswindows:
694
+ #
695
+ # Windows methods
696
+ #
697
+ def _get_handles(self, stdin, stdout, stderr):
698
+ """Construct and return tupel with IO objects:
699
+ p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
700
+ """
701
+ if stdin is None and stdout is None and stderr is None:
702
+ return (None, None, None, None, None, None)
703
+
704
+ p2cread, p2cwrite = None, None
705
+ c2pread, c2pwrite = None, None
706
+ errread, errwrite = None, None
707
+
708
+ if stdin is None:
709
+ p2cread = GetStdHandle(STD_INPUT_HANDLE)
710
+ elif stdin == PIPE:
711
+ p2cread, p2cwrite = CreatePipe(None, 0)
712
+ # Detach and turn into fd
713
+ p2cwrite = p2cwrite.Detach()
714
+ p2cwrite = msvcrt.open_osfhandle(p2cwrite, 0)
715
+ elif is_int(stdin):
716
+ p2cread = msvcrt.get_osfhandle(stdin)
717
+ else:
718
+ # Assuming file-like object
719
+ p2cread = msvcrt.get_osfhandle(stdin.fileno())
720
+ p2cread = self._make_inheritable(p2cread)
721
+
722
+ if stdout is None:
723
+ c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE)
724
+ elif stdout == PIPE:
725
+ c2pread, c2pwrite = CreatePipe(None, 0)
726
+ # Detach and turn into fd
727
+ c2pread = c2pread.Detach()
728
+ c2pread = msvcrt.open_osfhandle(c2pread, 0)
729
+ elif is_int(stdout):
730
+ c2pwrite = msvcrt.get_osfhandle(stdout)
731
+ else:
732
+ # Assuming file-like object
733
+ c2pwrite = msvcrt.get_osfhandle(stdout.fileno())
734
+ c2pwrite = self._make_inheritable(c2pwrite)
735
+
736
+ if stderr is None:
737
+ errwrite = GetStdHandle(STD_ERROR_HANDLE)
738
+ elif stderr == PIPE:
739
+ errread, errwrite = CreatePipe(None, 0)
740
+ # Detach and turn into fd
741
+ errread = errread.Detach()
742
+ errread = msvcrt.open_osfhandle(errread, 0)
743
+ elif stderr == STDOUT:
744
+ errwrite = c2pwrite
745
+ elif is_int(stderr):
746
+ errwrite = msvcrt.get_osfhandle(stderr)
747
+ else:
748
+ # Assuming file-like object
749
+ errwrite = msvcrt.get_osfhandle(stderr.fileno())
750
+ errwrite = self._make_inheritable(errwrite)
751
+
752
+ return (p2cread, p2cwrite,
753
+ c2pread, c2pwrite,
754
+ errread, errwrite)
755
+
756
+
757
+ def _make_inheritable(self, handle):
758
+ """Return a duplicate of handle, which is inheritable"""
759
+ return DuplicateHandle(GetCurrentProcess(), handle,
760
+ GetCurrentProcess(), 0, 1,
761
+ DUPLICATE_SAME_ACCESS)
762
+
763
+
764
+ def _find_w9xpopen(self):
765
+ """Find and return absolut path to w9xpopen.exe"""
766
+ w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)),
767
+ "w9xpopen.exe")
768
+ if not os.path.exists(w9xpopen):
769
+ # Eeek - file-not-found - possibly an embedding
770
+ # situation - see if we can locate it in sys.exec_prefix
771
+ w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix),
772
+ "w9xpopen.exe")
773
+ if not os.path.exists(w9xpopen):
774
+ raise RuntimeError("Cannot locate w9xpopen.exe, which is "
775
+ "needed for Popen to work with your "
776
+ "shell or platform.")
777
+ return w9xpopen
778
+
779
+
780
+ def _execute_child(self, args, executable, preexec_fn, close_fds,
781
+ cwd, env, universal_newlines,
782
+ startupinfo, creationflags, shell,
783
+ p2cread, p2cwrite,
784
+ c2pread, c2pwrite,
785
+ errread, errwrite):
786
+ """Execute program (MS Windows version)"""
787
+
788
+ if not isinstance(args, types.StringTypes):
789
+ args = list2cmdline(args)
790
+
791
+ # Process startup details
792
+ if startupinfo is None:
793
+ startupinfo = STARTUPINFO()
794
+ if None not in (p2cread, c2pwrite, errwrite):
795
+ startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESTDHANDLES
796
+ startupinfo.hStdInput = p2cread
797
+ startupinfo.hStdOutput = c2pwrite
798
+ startupinfo.hStdError = errwrite
799
+
800
+ if shell:
801
+ startupinfo.dwFlags = startupinfo.dwFlags | STARTF_USESHOWWINDOW
802
+ startupinfo.wShowWindow = SW_HIDE
803
+ comspec = os.environ.get("COMSPEC", "cmd.exe")
804
+ args = comspec + " /c " + args
805
+ if (GetVersion() >= 0x80000000L or
806
+ os.path.basename(comspec).lower() == "command.com"):
807
+ # Win9x, or using command.com on NT. We need to
808
+ # use the w9xpopen intermediate program. For more
809
+ # information, see KB Q150956
810
+ # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp)
811
+ w9xpopen = self._find_w9xpopen()
812
+ args = '"%s" %s' % (w9xpopen, args)
813
+ # Not passing CREATE_NEW_CONSOLE has been known to
814
+ # cause random failures on win9x. Specifically a
815
+ # dialog: "Your program accessed mem currently in
816
+ # use at xxx" and a hopeful warning about the
817
+ # stability of your system. Cost is Ctrl+C wont
818
+ # kill children.
819
+ creationflags = creationflags | CREATE_NEW_CONSOLE
820
+
821
+ # Start the process
822
+ try:
823
+ hp, ht, pid, tid = CreateProcess(executable, args,
824
+ # no special security
825
+ None, None,
826
+ # must inherit handles to pass std
827
+ # handles
828
+ 1,
829
+ creationflags,
830
+ env,
831
+ cwd,
832
+ startupinfo)
833
+ except pywintypes.error, e:
834
+ # Translate pywintypes.error to WindowsError, which is
835
+ # a subclass of OSError. FIXME: We should really
836
+ # translate errno using _sys_errlist (or simliar), but
837
+ # how can this be done from Python?
838
+ raise WindowsError(*e.args)
839
+
840
+ # Retain the process handle, but close the thread handle
841
+ self._child_created = True
842
+ self._handle = hp
843
+ self.pid = pid
844
+ ht.Close()
845
+
846
+ # Child is launched. Close the parent's copy of those pipe
847
+ # handles that only the child should have open. You need
848
+ # to make sure that no handles to the write end of the
849
+ # output pipe are maintained in this process or else the
850
+ # pipe will not close when the child process exits and the
851
+ # ReadFile will hang.
852
+ if p2cread is not None:
853
+ p2cread.Close()
854
+ if c2pwrite is not None:
855
+ c2pwrite.Close()
856
+ if errwrite is not None:
857
+ errwrite.Close()
858
+
859
+
860
+ def poll(self, _deadstate=None):
861
+ """Check if child process has terminated. Returns returncode
862
+ attribute."""
863
+ if self.returncode is None:
864
+ if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0:
865
+ self.returncode = GetExitCodeProcess(self._handle)
866
+ return self.returncode
867
+
868
+
869
+ def wait(self):
870
+ """Wait for child process to terminate. Returns returncode
871
+ attribute."""
872
+ if self.returncode is None:
873
+ obj = WaitForSingleObject(self._handle, INFINITE)
874
+ self.returncode = GetExitCodeProcess(self._handle)
875
+ return self.returncode
876
+
877
+
878
+ def _readerthread(self, fh, buffer):
879
+ buffer.append(fh.read())
880
+
881
+
882
+ def _communicate(self, input):
883
+ stdout = None # Return
884
+ stderr = None # Return
885
+
886
+ if self.stdout:
887
+ stdout = []
888
+ stdout_thread = threading.Thread(target=self._readerthread,
889
+ args=(self.stdout, stdout))
890
+ stdout_thread.setDaemon(True)
891
+ stdout_thread.start()
892
+ if self.stderr:
893
+ stderr = []
894
+ stderr_thread = threading.Thread(target=self._readerthread,
895
+ args=(self.stderr, stderr))
896
+ stderr_thread.setDaemon(True)
897
+ stderr_thread.start()
898
+
899
+ if self.stdin:
900
+ if input is not None:
901
+ self.stdin.write(input)
902
+ self.stdin.close()
903
+
904
+ if self.stdout:
905
+ stdout_thread.join()
906
+ if self.stderr:
907
+ stderr_thread.join()
908
+
909
+ # All data exchanged. Translate lists into strings.
910
+ if stdout is not None:
911
+ stdout = stdout[0]
912
+ if stderr is not None:
913
+ stderr = stderr[0]
914
+
915
+ # Translate newlines, if requested. We cannot let the file
916
+ # object do the translation: It is based on stdio, which is
917
+ # impossible to combine with select (unless forcing no
918
+ # buffering).
919
+ if self.universal_newlines and hasattr(file, 'newlines'):
920
+ if stdout:
921
+ stdout = self._translate_newlines(stdout)
922
+ if stderr:
923
+ stderr = self._translate_newlines(stderr)
924
+
925
+ self.wait()
926
+ return (stdout, stderr)
927
+
928
+ else:
929
+ #
930
+ # POSIX methods
931
+ #
932
+ def _get_handles(self, stdin, stdout, stderr):
933
+ """Construct and return tupel with IO objects:
934
+ p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
935
+ """
936
+ p2cread, p2cwrite = None, None
937
+ c2pread, c2pwrite = None, None
938
+ errread, errwrite = None, None
939
+
940
+ if stdin is None:
941
+ pass
942
+ elif stdin == PIPE:
943
+ p2cread, p2cwrite = os.pipe()
944
+ elif is_int(stdin):
945
+ p2cread = stdin
946
+ else:
947
+ # Assuming file-like object
948
+ p2cread = stdin.fileno()
949
+
950
+ if stdout is None:
951
+ pass
952
+ elif stdout == PIPE:
953
+ c2pread, c2pwrite = os.pipe()
954
+ elif is_int(stdout):
955
+ c2pwrite = stdout
956
+ else:
957
+ # Assuming file-like object
958
+ c2pwrite = stdout.fileno()
959
+
960
+ if stderr is None:
961
+ pass
962
+ elif stderr == PIPE:
963
+ errread, errwrite = os.pipe()
964
+ elif stderr == STDOUT:
965
+ errwrite = c2pwrite
966
+ elif is_int(stderr):
967
+ errwrite = stderr
968
+ else:
969
+ # Assuming file-like object
970
+ errwrite = stderr.fileno()
971
+
972
+ return (p2cread, p2cwrite,
973
+ c2pread, c2pwrite,
974
+ errread, errwrite)
975
+
976
+
977
+ def _set_cloexec_flag(self, fd):
978
+ try:
979
+ cloexec_flag = fcntl.FD_CLOEXEC
980
+ except AttributeError:
981
+ cloexec_flag = 1
982
+
983
+ old = fcntl.fcntl(fd, fcntl.F_GETFD)
984
+ fcntl.fcntl(fd, fcntl.F_SETFD, old | cloexec_flag)
985
+
986
+
987
+ def _close_fds(self, but):
988
+ for i in range(3, MAXFD):
989
+ if i == but:
990
+ continue
991
+ try:
992
+ os.close(i)
993
+ except KeyboardInterrupt:
994
+ raise # SCons: don't swallow keyboard interrupts
995
+ except:
996
+ pass
997
+
998
+
999
+ def _execute_child(self, args, executable, preexec_fn, close_fds,
1000
+ cwd, env, universal_newlines,
1001
+ startupinfo, creationflags, shell,
1002
+ p2cread, p2cwrite,
1003
+ c2pread, c2pwrite,
1004
+ errread, errwrite):
1005
+ """Execute program (POSIX version)"""
1006
+
1007
+ if is_string(args):
1008
+ args = [args]
1009
+
1010
+ if shell:
1011
+ args = ["/bin/sh", "-c"] + args
1012
+
1013
+ if executable is None:
1014
+ executable = args[0]
1015
+
1016
+ # For transferring possible exec failure from child to parent
1017
+ # The first char specifies the exception type: 0 means
1018
+ # OSError, 1 means some other error.
1019
+ errpipe_read, errpipe_write = os.pipe()
1020
+ self._set_cloexec_flag(errpipe_write)
1021
+
1022
+ self.pid = os.fork()
1023
+ self._child_created = True
1024
+ if self.pid == 0:
1025
+ # Child
1026
+ try:
1027
+ # Close parent's pipe ends
1028
+ if p2cwrite:
1029
+ os.close(p2cwrite)
1030
+ if c2pread:
1031
+ os.close(c2pread)
1032
+ if errread:
1033
+ os.close(errread)
1034
+ os.close(errpipe_read)
1035
+
1036
+ # Dup fds for child
1037
+ if p2cread:
1038
+ os.dup2(p2cread, 0)
1039
+ if c2pwrite:
1040
+ os.dup2(c2pwrite, 1)
1041
+ if errwrite:
1042
+ os.dup2(errwrite, 2)
1043
+
1044
+ # Close pipe fds. Make sure we don't close the same
1045
+ # fd more than once, or standard fds.
1046
+ try:
1047
+ set
1048
+ except NameError:
1049
+ # Fall-back for earlier Python versions, so epydoc
1050
+ # can use this module directly to execute things.
1051
+ if p2cread:
1052
+ os.close(p2cread)
1053
+ if c2pwrite and c2pwrite not in (p2cread,):
1054
+ os.close(c2pwrite)
1055
+ if errwrite and errwrite not in (p2cread, c2pwrite):
1056
+ os.close(errwrite)
1057
+ else:
1058
+ for fd in set((p2cread, c2pwrite, errwrite))-set((0,1,2)):
1059
+ if fd: os.close(fd)
1060
+
1061
+ # Close all other fds, if asked for
1062
+ if close_fds:
1063
+ self._close_fds(but=errpipe_write)
1064
+
1065
+ if cwd is not None:
1066
+ os.chdir(cwd)
1067
+
1068
+ if preexec_fn:
1069
+ apply(preexec_fn)
1070
+
1071
+ if env is None:
1072
+ os.execvp(executable, args)
1073
+ else:
1074
+ os.execvpe(executable, args, env)
1075
+
1076
+ except KeyboardInterrupt:
1077
+ raise # SCons: don't swallow keyboard interrupts
1078
+
1079
+ except:
1080
+ exc_type, exc_value, tb = sys.exc_info()
1081
+ # Save the traceback and attach it to the exception object
1082
+ exc_lines = traceback.format_exception(exc_type,
1083
+ exc_value,
1084
+ tb)
1085
+ exc_value.child_traceback = ''.join(exc_lines)
1086
+ os.write(errpipe_write, pickle.dumps(exc_value))
1087
+
1088
+ # This exitcode won't be reported to applications, so it
1089
+ # really doesn't matter what we return.
1090
+ os._exit(255)
1091
+
1092
+ # Parent
1093
+ os.close(errpipe_write)
1094
+ if p2cread and p2cwrite:
1095
+ os.close(p2cread)
1096
+ if c2pwrite and c2pread:
1097
+ os.close(c2pwrite)
1098
+ if errwrite and errread:
1099
+ os.close(errwrite)
1100
+
1101
+ # Wait for exec to fail or succeed; possibly raising exception
1102
+ data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
1103
+ os.close(errpipe_read)
1104
+ if data != "":
1105
+ os.waitpid(self.pid, 0)
1106
+ child_exception = pickle.loads(data)
1107
+ raise child_exception
1108
+
1109
+
1110
+ def _handle_exitstatus(self, sts):
1111
+ if os.WIFSIGNALED(sts):
1112
+ self.returncode = -os.WTERMSIG(sts)
1113
+ elif os.WIFEXITED(sts):
1114
+ self.returncode = os.WEXITSTATUS(sts)
1115
+ else:
1116
+ # Should never happen
1117
+ raise RuntimeError("Unknown child exit status!")
1118
+
1119
+
1120
+ def poll(self, _deadstate=None):
1121
+ """Check if child process has terminated. Returns returncode
1122
+ attribute."""
1123
+ if self.returncode is None:
1124
+ try:
1125
+ pid, sts = os.waitpid(self.pid, os.WNOHANG)
1126
+ if pid == self.pid:
1127
+ self._handle_exitstatus(sts)
1128
+ except os.error:
1129
+ if _deadstate is not None:
1130
+ self.returncode = _deadstate
1131
+ return self.returncode
1132
+
1133
+
1134
+ def wait(self):
1135
+ """Wait for child process to terminate. Returns returncode
1136
+ attribute."""
1137
+ if self.returncode is None:
1138
+ pid, sts = os.waitpid(self.pid, 0)
1139
+ self._handle_exitstatus(sts)
1140
+ return self.returncode
1141
+
1142
+
1143
+ def _communicate(self, input):
1144
+ read_set = []
1145
+ write_set = []
1146
+ stdout = None # Return
1147
+ stderr = None # Return
1148
+
1149
+ if self.stdin:
1150
+ # Flush stdio buffer. This might block, if the user has
1151
+ # been writing to .stdin in an uncontrolled fashion.
1152
+ self.stdin.flush()
1153
+ if input:
1154
+ write_set.append(self.stdin)
1155
+ else:
1156
+ self.stdin.close()
1157
+ if self.stdout:
1158
+ read_set.append(self.stdout)
1159
+ stdout = []
1160
+ if self.stderr:
1161
+ read_set.append(self.stderr)
1162
+ stderr = []
1163
+
1164
+ input_offset = 0
1165
+ while read_set or write_set:
1166
+ rlist, wlist, xlist = select.select(read_set, write_set, [])
1167
+
1168
+ if self.stdin in wlist:
1169
+ # When select has indicated that the file is writable,
1170
+ # we can write up to PIPE_BUF bytes without risk
1171
+ # blocking. POSIX defines PIPE_BUF >= 512
1172
+ m = memoryview(input)[input_offset:input_offset+512]
1173
+ bytes_written = os.write(self.stdin.fileno(), m)
1174
+ input_offset = input_offset + bytes_written
1175
+ if input_offset >= len(input):
1176
+ self.stdin.close()
1177
+ write_set.remove(self.stdin)
1178
+
1179
+ if self.stdout in rlist:
1180
+ data = os.read(self.stdout.fileno(), 1024)
1181
+ if data == "":
1182
+ self.stdout.close()
1183
+ read_set.remove(self.stdout)
1184
+ stdout.append(data)
1185
+
1186
+ if self.stderr in rlist:
1187
+ data = os.read(self.stderr.fileno(), 1024)
1188
+ if data == "":
1189
+ self.stderr.close()
1190
+ read_set.remove(self.stderr)
1191
+ stderr.append(data)
1192
+
1193
+ # All data exchanged. Translate lists into strings.
1194
+ if stdout is not None:
1195
+ stdout = ''.join(stdout)
1196
+ if stderr is not None:
1197
+ stderr = ''.join(stderr)
1198
+
1199
+ # Translate newlines, if requested. We cannot let the file
1200
+ # object do the translation: It is based on stdio, which is
1201
+ # impossible to combine with select (unless forcing no
1202
+ # buffering).
1203
+ if self.universal_newlines and hasattr(file, 'newlines'):
1204
+ if stdout:
1205
+ stdout = self._translate_newlines(stdout)
1206
+ if stderr:
1207
+ stderr = self._translate_newlines(stderr)
1208
+
1209
+ self.wait()
1210
+ return (stdout, stderr)
1211
+
1212
+
1213
+ def _demo_posix():
1214
+ #
1215
+ # Example 1: Simple redirection: Get process list
1216
+ #
1217
+ plist = Popen(["ps"], stdout=PIPE).communicate()[0]
1218
+ print "Process list:"
1219
+ print plist
1220
+
1221
+ #
1222
+ # Example 2: Change uid before executing child
1223
+ #
1224
+ if os.getuid() == 0:
1225
+ p = Popen(["id"], preexec_fn=lambda: os.setuid(100))
1226
+ p.wait()
1227
+
1228
+ #
1229
+ # Example 3: Connecting several subprocesses
1230
+ #
1231
+ print "Looking for 'hda'..."
1232
+ p1 = Popen(["dmesg"], stdout=PIPE)
1233
+ p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
1234
+ print repr(p2.communicate()[0])
1235
+
1236
+ #
1237
+ # Example 4: Catch execution error
1238
+ #
1239
+ print
1240
+ print "Trying a weird file..."
1241
+ try:
1242
+ print Popen(["/this/path/does/not/exist"]).communicate()
1243
+ except OSError, e:
1244
+ if e.errno == errno.ENOENT:
1245
+ print "The file didn't exist. I thought so..."
1246
+ print "Child traceback:"
1247
+ print e.child_traceback
1248
+ else:
1249
+ print "Error", e.errno
1250
+ else:
1251
+ sys.stderr.write( "Gosh. No error.\n" )
1252
+
1253
+
1254
+ def _demo_windows():
1255
+ #
1256
+ # Example 1: Connecting several subprocesses
1257
+ #
1258
+ print "Looking for 'PROMPT' in set output..."
1259
+ p1 = Popen("set", stdout=PIPE, shell=True)
1260
+ p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE)
1261
+ print repr(p2.communicate()[0])
1262
+
1263
+ #
1264
+ # Example 2: Simple execution of program
1265
+ #
1266
+ print "Executing calc..."
1267
+ p = Popen("calc")
1268
+ p.wait()
1269
+
1270
+
1271
+ if __name__ == "__main__":
1272
+ if mswindows:
1273
+ _demo_windows()
1274
+ else:
1275
+ _demo_posix()
1276
+
1277
+ # Local Variables:
1278
+ # tab-width:4
1279
+ # indent-tabs-mode:nil
1280
+ # End:
1281
+ # vim: set expandtab tabstop=4 shiftwidth=4: