pygments.rb-jruby 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/CHANGELOG.md +71 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +17 -0
  6. data/README.md +118 -0
  7. data/Rakefile +66 -0
  8. data/bench.rb +22 -0
  9. data/cache-lexers.rb +8 -0
  10. data/lexers +0 -0
  11. data/lib/pygments.rb +8 -0
  12. data/lib/pygments/lexer.rb +148 -0
  13. data/lib/pygments/mentos.py +351 -0
  14. data/lib/pygments/popen.rb +404 -0
  15. data/lib/pygments/version.rb +3 -0
  16. data/pygments.rb.gemspec +24 -0
  17. data/test/test_data.c +2581 -0
  18. data/test/test_data.py +514 -0
  19. data/test/test_data_generated +2582 -0
  20. data/test/test_pygments.rb +287 -0
  21. data/vendor/custom_lexers/github.py +565 -0
  22. data/vendor/pygments-main/AUTHORS +153 -0
  23. data/vendor/pygments-main/CHANGES +889 -0
  24. data/vendor/pygments-main/LICENSE +25 -0
  25. data/vendor/pygments-main/MANIFEST.in +6 -0
  26. data/vendor/pygments-main/Makefile +59 -0
  27. data/vendor/pygments-main/REVISION +1 -0
  28. data/vendor/pygments-main/TODO +15 -0
  29. data/vendor/pygments-main/docs/generate.py +472 -0
  30. data/vendor/pygments-main/docs/pygmentize.1 +94 -0
  31. data/vendor/pygments-main/docs/src/api.txt +270 -0
  32. data/vendor/pygments-main/docs/src/authors.txt +5 -0
  33. data/vendor/pygments-main/docs/src/changelog.txt +5 -0
  34. data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
  35. data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
  36. data/vendor/pygments-main/docs/src/filters.txt +42 -0
  37. data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
  38. data/vendor/pygments-main/docs/src/formatters.txt +48 -0
  39. data/vendor/pygments-main/docs/src/index.txt +69 -0
  40. data/vendor/pygments-main/docs/src/installation.txt +71 -0
  41. data/vendor/pygments-main/docs/src/integrate.txt +48 -0
  42. data/vendor/pygments-main/docs/src/java.txt +70 -0
  43. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
  44. data/vendor/pygments-main/docs/src/lexers.txt +67 -0
  45. data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
  46. data/vendor/pygments-main/docs/src/plugins.txt +93 -0
  47. data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
  48. data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
  49. data/vendor/pygments-main/docs/src/styles.txt +143 -0
  50. data/vendor/pygments-main/docs/src/tokens.txt +349 -0
  51. data/vendor/pygments-main/docs/src/unicode.txt +49 -0
  52. data/vendor/pygments-main/external/autopygmentize +64 -0
  53. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
  54. data/vendor/pygments-main/external/markdown-processor.py +67 -0
  55. data/vendor/pygments-main/external/moin-parser.py +112 -0
  56. data/vendor/pygments-main/external/pygments.bashcomp +38 -0
  57. data/vendor/pygments-main/external/rst-directive-old.py +77 -0
  58. data/vendor/pygments-main/external/rst-directive.py +83 -0
  59. data/vendor/pygments-main/ez_setup.py +276 -0
  60. data/vendor/pygments-main/pygmentize +7 -0
  61. data/vendor/pygments-main/pygments/__init__.py +91 -0
  62. data/vendor/pygments-main/pygments/cmdline.py +441 -0
  63. data/vendor/pygments-main/pygments/console.py +74 -0
  64. data/vendor/pygments-main/pygments/filter.py +74 -0
  65. data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
  66. data/vendor/pygments-main/pygments/formatter.py +95 -0
  67. data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
  68. data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
  69. data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
  70. data/vendor/pygments-main/pygments/formatters/html.py +821 -0
  71. data/vendor/pygments-main/pygments/formatters/img.py +553 -0
  72. data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
  73. data/vendor/pygments-main/pygments/formatters/other.py +115 -0
  74. data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
  75. data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
  76. data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
  77. data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
  78. data/vendor/pygments-main/pygments/lexer.py +765 -0
  79. data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
  80. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
  81. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
  82. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
  83. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
  84. data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
  85. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
  86. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
  87. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
  88. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
  89. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
  90. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  91. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
  92. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
  93. data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
  94. data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
  96. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  97. data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
  98. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  99. data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
  100. data/vendor/pygments-main/pygments/lexers/github.py +565 -0
  101. data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
  102. data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
  103. data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
  104. data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
  105. data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
  106. data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
  107. data/vendor/pygments-main/pygments/lexers/special.py +100 -0
  108. data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
  109. data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
  110. data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
  111. data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
  112. data/vendor/pygments-main/pygments/modeline.py +40 -0
  113. data/vendor/pygments-main/pygments/plugin.py +74 -0
  114. data/vendor/pygments-main/pygments/scanner.py +104 -0
  115. data/vendor/pygments-main/pygments/style.py +117 -0
  116. data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
  117. data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
  118. data/vendor/pygments-main/pygments/styles/borland.py +51 -0
  119. data/vendor/pygments-main/pygments/styles/bw.py +49 -0
  120. data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
  121. data/vendor/pygments-main/pygments/styles/default.py +73 -0
  122. data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
  123. data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
  124. data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
  125. data/vendor/pygments-main/pygments/styles/manni.py +75 -0
  126. data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
  127. data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
  128. data/vendor/pygments-main/pygments/styles/native.py +65 -0
  129. data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
  130. data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
  131. data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
  132. data/vendor/pygments-main/pygments/styles/tango.py +141 -0
  133. data/vendor/pygments-main/pygments/styles/trac.py +63 -0
  134. data/vendor/pygments-main/pygments/styles/vim.py +63 -0
  135. data/vendor/pygments-main/pygments/styles/vs.py +38 -0
  136. data/vendor/pygments-main/pygments/token.py +195 -0
  137. data/vendor/pygments-main/pygments/unistring.py +140 -0
  138. data/vendor/pygments-main/pygments/util.py +277 -0
  139. data/vendor/pygments-main/scripts/check_sources.py +242 -0
  140. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
  141. data/vendor/pygments-main/scripts/epydoc.css +280 -0
  142. data/vendor/pygments-main/scripts/find_codetags.py +205 -0
  143. data/vendor/pygments-main/scripts/find_error.py +170 -0
  144. data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
  145. data/vendor/pygments-main/scripts/pylintrc +301 -0
  146. data/vendor/pygments-main/scripts/reindent.py +291 -0
  147. data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
  148. data/vendor/pygments-main/setup.cfg +7 -0
  149. data/vendor/pygments-main/setup.py +90 -0
  150. data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
  151. data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
  152. data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
  153. data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
  154. data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
  155. data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
  156. data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
  157. data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
  158. data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
  159. data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
  160. data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
  161. data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
  162. data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
  163. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  164. data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
  165. data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
  166. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  167. data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
  168. data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
  169. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  170. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  171. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  172. data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
  173. data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
  174. data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
  175. data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
  176. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  177. data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
  178. data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
  179. data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
  180. data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
  181. data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
  182. data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
  183. data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
  184. data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
  185. data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
  186. data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
  187. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
  188. data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
  189. data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
  190. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
  191. data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
  192. data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
  193. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
  194. data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
  195. data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
  196. data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
  197. data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
  198. data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
  199. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
  200. data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
  201. data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
  202. data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
  203. data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
  204. data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
  205. data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
  206. data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
  207. data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
  208. data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
  209. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  210. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  211. data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
  212. data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
  213. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  214. data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
  215. data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
  216. data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
  217. data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
  218. data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
  219. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  220. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  221. data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
  222. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  223. data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
  224. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  225. data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
  226. data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
  227. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  228. data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
  229. data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
  230. data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
  231. data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
  232. data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
  233. data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
  234. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  235. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  236. data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
  237. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  238. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  239. data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
  240. data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
  241. data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
  242. data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
  243. data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
  244. data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
  245. data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
  246. data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
  247. data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
  248. data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
  249. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  250. data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
  251. data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
  252. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  253. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
  254. data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
  255. data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
  256. data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
  257. data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
  258. data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
  259. data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
  260. data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
  261. data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
  262. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
  263. data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
  264. data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
  265. data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
  266. data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
  267. data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
  268. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  269. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  270. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  271. data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
  272. data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
  273. data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
  274. data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
  275. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  276. data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
  277. data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
  278. data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
  279. data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
  280. data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
  281. data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
  282. data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
  283. data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
  284. data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
  285. data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
  286. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  287. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  288. data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
  289. data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
  290. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  291. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
  292. data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
  293. data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
  294. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
  295. data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
  296. data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
  297. data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
  298. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  299. data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
  300. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
  301. data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
  302. data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
  303. data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
  304. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
  305. data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
  306. data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
  307. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
  308. data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
  309. data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
  310. data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
  311. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
  312. data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
  313. data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
  314. data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
  315. data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
  316. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
  317. data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
  318. data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
  319. data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
  320. data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
  321. data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
  322. data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
  323. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  324. data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
  325. data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
  326. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  327. data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
  328. data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
  329. data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
  330. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
  331. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
  332. data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
  333. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
  334. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  335. data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
  336. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
  337. data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
  338. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
  339. data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
  340. data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
  341. data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
  342. data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
  343. data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
  344. data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
  345. data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
  346. data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
  347. data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
  348. data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
  349. data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
  350. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  351. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  352. data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
  353. data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
  354. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  355. data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
  356. data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
  357. data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
  358. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  359. data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
  360. data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
  361. data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
  362. data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
  363. data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
  364. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  365. data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
  366. data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
  367. data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
  368. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  369. data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
  370. data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
  371. data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
  372. data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
  373. data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
  374. data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
  375. data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
  376. data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
  377. data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
  378. data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
  379. data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
  380. data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
  381. data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
  382. data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
  383. data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
  384. data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
  385. data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
  386. data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
  387. data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
  388. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  389. data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
  390. data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
  391. data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
  392. data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
  393. data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
  394. data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
  395. data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
  396. data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
  397. data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
  398. data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
  399. data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
  400. data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
  401. data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
  402. data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
  403. data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
  404. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
  405. data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
  406. data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
  407. data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
  408. data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
  409. data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
  410. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
  411. data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
  412. data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
  413. data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
  414. data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
  415. data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
  416. data/vendor/pygments-main/tests/old_run.py +138 -0
  417. data/vendor/pygments-main/tests/run.py +49 -0
  418. data/vendor/pygments-main/tests/support.py +15 -0
  419. data/vendor/pygments-main/tests/support/tags +36 -0
  420. data/vendor/pygments-main/tests/test_basic_api.py +295 -0
  421. data/vendor/pygments-main/tests/test_clexer.py +31 -0
  422. data/vendor/pygments-main/tests/test_cmdline.py +105 -0
  423. data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
  424. data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
  425. data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
  426. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  427. data/vendor/pygments-main/tests/test_perllexer.py +137 -0
  428. data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
  429. data/vendor/pygments-main/tests/test_token.py +46 -0
  430. data/vendor/pygments-main/tests/test_using_api.py +40 -0
  431. data/vendor/pygments-main/tests/test_util.py +135 -0
  432. data/vendor/simplejson/.gitignore +10 -0
  433. data/vendor/simplejson/.travis.yml +5 -0
  434. data/vendor/simplejson/CHANGES.txt +291 -0
  435. data/vendor/simplejson/LICENSE.txt +19 -0
  436. data/vendor/simplejson/MANIFEST.in +5 -0
  437. data/vendor/simplejson/README.rst +19 -0
  438. data/vendor/simplejson/conf.py +179 -0
  439. data/vendor/simplejson/index.rst +628 -0
  440. data/vendor/simplejson/scripts/make_docs.py +18 -0
  441. data/vendor/simplejson/setup.py +104 -0
  442. data/vendor/simplejson/simplejson/__init__.py +510 -0
  443. data/vendor/simplejson/simplejson/_speedups.c +2745 -0
  444. data/vendor/simplejson/simplejson/decoder.py +425 -0
  445. data/vendor/simplejson/simplejson/encoder.py +567 -0
  446. data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
  447. data/vendor/simplejson/simplejson/scanner.py +77 -0
  448. data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
  449. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
  450. data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
  451. data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
  452. data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
  453. data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
  454. data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
  455. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
  456. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
  457. data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
  458. data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
  459. data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
  460. data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
  461. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
  462. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
  463. data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
  464. data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
  465. data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
  466. data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
  467. data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
  468. data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
  469. data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
  470. data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
  471. data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
  472. data/vendor/simplejson/simplejson/tool.py +39 -0
  473. metadata +557 -0
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Some Number Test
3
+ */
4
+
5
+ int i = 24241424;
6
+ float f1 = 342423423.24234;
7
+ float f2 = 25235235.;
8
+ float f3 = .234234;
9
+ float f4 = 234243e+34343;
10
+ float f5 = 24234e-234;
11
+ int o = 0234;
12
+ int h = 0x2342;
@@ -0,0 +1,32 @@
1
+ #import "Somefile.h"
2
+
3
+ @implementation ABC
4
+
5
+ - (id)a:(B)b {
6
+ return 1;
7
+ }
8
+
9
+ @end
10
+
11
+ @implementation ABC
12
+
13
+ - (void)xyz;
14
+
15
+ @end
16
+
17
+ NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
18
+ @"quattuor", @"four", @"quinque", @"five", @"sex", @"six", nil];
19
+
20
+
21
+ NSString *key;
22
+ for (key in dictionary) {
23
+ NSLog(@"English: %@, Latin: %@", key, [dictionary valueForKey:key]);
24
+ }
25
+
26
+ // Literals
27
+ NSArray *a = @[ @"1", @"2" ];
28
+
29
+ NSDictionary *d = @{ @"key": @"value" };
30
+
31
+ NSNumber *n1 = @( 1 );
32
+ NSNumber *n2 = @( [a length] );
@@ -0,0 +1,24 @@
1
+ // MyClass.h
2
+ @interface MyClass : NSObject
3
+ {
4
+ NSString *value;
5
+ NSTextField *textField;
6
+ @private
7
+ NSDate *lastModifiedDate;
8
+ }
9
+ @property(copy, readwrite) NSString *value;
10
+ @property(retain) IBOutlet NSTextField *textField;
11
+ @end
12
+
13
+ // MyClass.m
14
+ // Class extension to declare private property
15
+ @interface MyClass ()
16
+ @property(retain) NSDate *lastModifiedDate;
17
+ @end
18
+
19
+ @implementation MyClass
20
+ @synthesize value;
21
+ @synthesize textField;
22
+ @synthesize lastModifiedDate;
23
+ // implementation continues
24
+ @end
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/perl
2
+
3
+ # from http://gist.github.com/485595
4
+ use strict;
5
+ use warnings;
6
+ use Time::HiRes 'usleep';
7
+
8
+ for (1..5) {
9
+ open my $in, '<', '/proc/sys/kernel/random/entropy_avail' or die;
10
+ print <$in>;
11
+ close $in;
12
+ usleep 100_000;
13
+ }
14
+
15
+ # other miscellaneous tests of numbers separated by _
16
+ #usleep 100_000;
17
+ 100_000_000;
18
+ my $nichts = 0.005_006;
19
+ print "$nichts\n";
20
+ my $nichts2 = 0.005_006_007;
21
+ print 900_800_700.005_006_007, $/;
22
+
23
+ # numbers from `man 1 perlnumber`
24
+ my $n;
25
+ $n = 1234; # decimal integer
26
+ $n = 0b1110011; # binary integer
27
+ $n = 01234; # octal integer
28
+ $n = 0x1234; # hexadecimal integer
29
+ $n = 12.34e-56; # exponential notation
30
+ $n = "-12.34e56"; # number specified as a string
31
+ $n = "1234"; # number specified as a string
32
+
33
+ # other numbers
34
+ for (
35
+ -9876,
36
+ +8765,
37
+ -9876.02,
38
+ -9876.02e+10,
39
+ +765_432e30,
40
+ 2002.,
41
+ .2002,
42
+ ) {
43
+ print $_, "\n";
44
+ }
45
+
46
+ # operators on numbers
47
+ for (
48
+ $n + 300,
49
+ $n - 300,
50
+ $n / 300 + 10,
51
+ $n * 250 / 2.0,
52
+ $n == 100,
53
+ $n != 100,
54
+ $n > 100,
55
+ $n >= 100,
56
+ $n < 100,
57
+ $n <= 100,
58
+ $n % 2,
59
+ abs $n,
60
+ ) {
61
+ print $_, "\n";
62
+ }
@@ -0,0 +1,998 @@
1
+
2
+ =head1 NAME
3
+
4
+ perl5db.pl - the perl debugger
5
+
6
+ =head1 SYNOPSIS
7
+
8
+ perl -d your_Perl_script
9
+
10
+ =head1 DESCRIPTION
11
+
12
+ After this routine is over, we don't have user code executing in the debugger's
13
+ context, so we can use C<my> freely.
14
+
15
+ =cut
16
+
17
+ ############################################## Begin lexical danger zone
18
+
19
+ # 'my' variables used here could leak into (that is, be visible in)
20
+ # the context that the code being evaluated is executing in. This means that
21
+ # the code could modify the debugger's variables.
22
+ #
23
+ # Fiddling with the debugger's context could be Bad. We insulate things as
24
+ # much as we can.
25
+
26
+ sub eval {
27
+
28
+ # 'my' would make it visible from user code
29
+ # but so does local! --tchrist
30
+ # Remember: this localizes @DB::res, not @main::res.
31
+ local @res;
32
+ {
33
+
34
+ # Try to keep the user code from messing with us. Save these so that
35
+ # even if the eval'ed code changes them, we can put them back again.
36
+ # Needed because the user could refer directly to the debugger's
37
+ # package globals (and any 'my' variables in this containing scope)
38
+ # inside the eval(), and we want to try to stay safe.
39
+ local $otrace = $trace;
40
+ local $osingle = $single;
41
+ local $od = $^D;
42
+
43
+ # Untaint the incoming eval() argument.
44
+ { ($evalarg) = $evalarg =~ /(.*)/s; }
45
+
46
+ # $usercontext built in DB::DB near the comment
47
+ # "set up the context for DB::eval ..."
48
+ # Evaluate and save any results.
49
+ @res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive debug
50
+
51
+ # Restore those old values.
52
+ $trace = $otrace;
53
+ $single = $osingle;
54
+ $^D = $od;
55
+ }
56
+
57
+ # Save the current value of $@, and preserve it in the debugger's copy
58
+ # of the saved precious globals.
59
+ my $at = $@;
60
+
61
+ # Since we're only saving $@, we only have to localize the array element
62
+ # that it will be stored in.
63
+ local $saved[0]; # Preserve the old value of $@
64
+ eval { &DB::save };
65
+
66
+ # Now see whether we need to report an error back to the user.
67
+ if ($at) {
68
+ local $\ = '';
69
+ print $OUT $at;
70
+ }
71
+
72
+ # Display as required by the caller. $onetimeDump and $onetimedumpDepth
73
+ # are package globals.
74
+ elsif ($onetimeDump) {
75
+ if ( $onetimeDump eq 'dump' ) {
76
+ local $option{dumpDepth} = $onetimedumpDepth
77
+ if defined $onetimedumpDepth;
78
+ dumpit( $OUT, \@res );
79
+ }
80
+ elsif ( $onetimeDump eq 'methods' ) {
81
+ methods( $res[0] );
82
+ }
83
+ } ## end elsif ($onetimeDump)
84
+ @res;
85
+ } ## end sub eval
86
+
87
+ ############################################## End lexical danger zone
88
+
89
+ # After this point it is safe to introduce lexicals.
90
+ # The code being debugged will be executing in its own context, and
91
+ # can't see the inside of the debugger.
92
+ #
93
+ # However, one should not overdo it: leave as much control from outside as
94
+ # possible. If you make something a lexical, it's not going to be addressable
95
+ # from outside the debugger even if you know its name.
96
+
97
+ # This file is automatically included if you do perl -d.
98
+ # It's probably not useful to include this yourself.
99
+ #
100
+ # Before venturing further into these twisty passages, it is
101
+ # wise to read the perldebguts man page or risk the ire of dragons.
102
+ #
103
+ # (It should be noted that perldebguts will tell you a lot about
104
+ # the underlying mechanics of how the debugger interfaces into the
105
+ # Perl interpreter, but not a lot about the debugger itself. The new
106
+ # comments in this code try to address this problem.)
107
+
108
+ # Note that no subroutine call is possible until &DB::sub is defined
109
+ # (for subroutines defined outside of the package DB). In fact the same is
110
+ # true if $deep is not defined.
111
+
112
+ # Enhanced by ilya@math.ohio-state.edu (Ilya Zakharevich)
113
+
114
+ # modified Perl debugger, to be run from Emacs in perldb-mode
115
+ # Ray Lischner (uunet!mntgfx!lisch) as of 5 Nov 1990
116
+ # Johan Vromans -- upgrade to 4.0 pl 10
117
+ # Ilya Zakharevich -- patches after 5.001 (and some before ;-)
118
+
119
+ # (We have made efforts to clarify the comments in the change log
120
+ # in other places; some of them may seem somewhat obscure as they
121
+ # were originally written, and explaining them away from the code
122
+ # in question seems conterproductive.. -JM)
123
+
124
+ =head1 DEBUGGER INITIALIZATION
125
+
126
+ The debugger starts up in phases.
127
+
128
+ =head2 BASIC SETUP
129
+
130
+ First, it initializes the environment it wants to run in: turning off
131
+ warnings during its own compilation, defining variables which it will need
132
+ to avoid warnings later, setting itself up to not exit when the program
133
+ terminates, and defaulting to printing return values for the C<r> command.
134
+
135
+ =cut
136
+
137
+ # Needed for the statement after exec():
138
+ #
139
+ # This BEGIN block is simply used to switch off warnings during debugger
140
+ # compiliation. Probably it would be better practice to fix the warnings,
141
+ # but this is how it's done at the moment.
142
+
143
+ BEGIN {
144
+ $ini_warn = $^W;
145
+ $^W = 0;
146
+ } # Switch compilation warnings off until another BEGIN.
147
+
148
+ # test if assertions are supported and actived:
149
+ BEGIN {
150
+ $ini_assertion = eval "sub asserting_test : assertion {1}; 1";
151
+
152
+ # $ini_assertion = undef => assertions unsupported,
153
+ # " = 1 => assertions supported
154
+ # print "\$ini_assertion=$ini_assertion\n";
155
+ }
156
+
157
+ local ($^W) = 0; # Switch run-time warnings off during init.
158
+
159
+ =head2 THREADS SUPPORT
160
+
161
+ If we are running under a threaded Perl, we require threads and threads::shared
162
+ if the environment variable C<PERL5DB_THREADED> is set, to enable proper
163
+ threaded debugger control. C<-dt> can also be used to set this.
164
+
165
+ Each new thread will be announced and the debugger prompt will always inform
166
+ you of each new thread created. It will also indicate the thread id in which
167
+ we are currently running within the prompt like this:
168
+
169
+ [tid] DB<$i>
170
+
171
+ Where C<[tid]> is an integer thread id and C<$i> is the familiar debugger
172
+ command prompt. The prompt will show: C<[0]> when running under threads, but
173
+ not actually in a thread. C<[tid]> is consistent with C<gdb> usage.
174
+
175
+ While running under threads, when you set or delete a breakpoint (etc.), this
176
+ will apply to all threads, not just the currently running one. When you are
177
+ in a currently executing thread, you will stay there until it completes. With
178
+ the current implementation it is not currently possible to hop from one thread
179
+ to another.
180
+
181
+ The C<e> and C<E> commands are currently fairly minimal - see C<h e> and C<h E>.
182
+
183
+ Note that threading support was built into the debugger as of Perl version
184
+ C<5.8.6> and debugger version C<1.2.8>.
185
+
186
+ =cut
187
+
188
+ BEGIN {
189
+ # ensure we can share our non-threaded variables or no-op
190
+ if ($ENV{PERL5DB_THREADED}) {
191
+ require threads;
192
+ require threads::shared;
193
+ import threads::shared qw(share);
194
+ $DBGR;
195
+ share(\$DBGR);
196
+ lock($DBGR);
197
+ print "Threads support enabled\n";
198
+ } else {
199
+ *lock = sub(*) {};
200
+ *share = sub(*) {};
201
+ }
202
+ }
203
+
204
+ # This would probably be better done with "use vars", but that wasn't around
205
+ # when this code was originally written. (Neither was "use strict".) And on
206
+ # the principle of not fiddling with something that was working, this was
207
+ # left alone.
208
+ warn( # Do not ;-)
209
+ # These variables control the execution of 'dumpvar.pl'.
210
+ $dumpvar::hashDepth,
211
+ $dumpvar::arrayDepth,
212
+ $dumpvar::dumpDBFiles,
213
+ $dumpvar::dumpPackages,
214
+ $dumpvar::quoteHighBit,
215
+ $dumpvar::printUndef,
216
+ $dumpvar::globPrint,
217
+ $dumpvar::usageOnly,
218
+
219
+ # used to save @ARGV and extract any debugger-related flags.
220
+ @ARGS,
221
+
222
+ # used to control die() reporting in diesignal()
223
+ $Carp::CarpLevel,
224
+
225
+ # used to prevent multiple entries to diesignal()
226
+ # (if for instance diesignal() itself dies)
227
+ $panic,
228
+
229
+ # used to prevent the debugger from running nonstop
230
+ # after a restart
231
+ $second_time,
232
+ )
233
+ if 0;
234
+
235
+ foreach my $k (keys (%INC)) {
236
+ &share(\$main::{'_<'.$filename});
237
+ };
238
+
239
+ # Command-line + PERLLIB:
240
+ # Save the contents of @INC before they are modified elsewhere.
241
+ @ini_INC = @INC;
242
+
243
+ # This was an attempt to clear out the previous values of various
244
+ # trapped errors. Apparently it didn't help. XXX More info needed!
245
+ # $prevwarn = $prevdie = $prevbus = $prevsegv = ''; # Does not help?!
246
+
247
+ # We set these variables to safe values. We don't want to blindly turn
248
+ # off warnings, because other packages may still want them.
249
+ $trace = $signal = $single = 0; # Uninitialized warning suppression
250
+ # (local $^W cannot help - other packages!).
251
+
252
+ # Default to not exiting when program finishes; print the return
253
+ # value when the 'r' command is used to return from a subroutine.
254
+ $inhibit_exit = $option{PrintRet} = 1;
255
+
256
+ =head1 OPTION PROCESSING
257
+
258
+ The debugger's options are actually spread out over the debugger itself and
259
+ C<dumpvar.pl>; some of these are variables to be set, while others are
260
+ subs to be called with a value. To try to make this a little easier to
261
+ manage, the debugger uses a few data structures to define what options
262
+ are legal and how they are to be processed.
263
+
264
+ First, the C<@options> array defines the I<names> of all the options that
265
+ are to be accepted.
266
+
267
+ =cut
268
+
269
+ @options = qw(
270
+ CommandSet
271
+ hashDepth arrayDepth dumpDepth
272
+ DumpDBFiles DumpPackages DumpReused
273
+ compactDump veryCompact quote
274
+ HighBit undefPrint globPrint
275
+ PrintRet UsageOnly frame
276
+ AutoTrace TTY noTTY
277
+ ReadLine NonStop LineInfo
278
+ maxTraceLen recallCommand ShellBang
279
+ pager tkRunning ornaments
280
+ signalLevel warnLevel dieLevel
281
+ inhibit_exit ImmediateStop bareStringify
282
+ CreateTTY RemotePort windowSize
283
+ DollarCaretP OnlyAssertions WarnAssertions
284
+ );
285
+
286
+ @RememberOnROptions = qw(DollarCaretP OnlyAssertions);
287
+
288
+ =pod
289
+
290
+ Second, C<optionVars> lists the variables that each option uses to save its
291
+ state.
292
+
293
+ =cut
294
+
295
+ %optionVars = (
296
+ hashDepth => \$dumpvar::hashDepth,
297
+ arrayDepth => \$dumpvar::arrayDepth,
298
+ CommandSet => \$CommandSet,
299
+ DumpDBFiles => \$dumpvar::dumpDBFiles,
300
+ DumpPackages => \$dumpvar::dumpPackages,
301
+ DumpReused => \$dumpvar::dumpReused,
302
+ HighBit => \$dumpvar::quoteHighBit,
303
+ undefPrint => \$dumpvar::printUndef,
304
+ globPrint => \$dumpvar::globPrint,
305
+ UsageOnly => \$dumpvar::usageOnly,
306
+ CreateTTY => \$CreateTTY,
307
+ bareStringify => \$dumpvar::bareStringify,
308
+ frame => \$frame,
309
+ AutoTrace => \$trace,
310
+ inhibit_exit => \$inhibit_exit,
311
+ maxTraceLen => \$maxtrace,
312
+ ImmediateStop => \$ImmediateStop,
313
+ RemotePort => \$remoteport,
314
+ windowSize => \$window,
315
+ WarnAssertions => \$warnassertions,
316
+ );
317
+
318
+ =pod
319
+
320
+ Third, C<%optionAction> defines the subroutine to be called to process each
321
+ option.
322
+
323
+ =cut
324
+
325
+ %optionAction = (
326
+ compactDump => \&dumpvar::compactDump,
327
+ veryCompact => \&dumpvar::veryCompact,
328
+ quote => \&dumpvar::quote,
329
+ TTY => \&TTY,
330
+ noTTY => \&noTTY,
331
+ ReadLine => \&ReadLine,
332
+ NonStop => \&NonStop,
333
+ LineInfo => \&LineInfo,
334
+ recallCommand => \&recallCommand,
335
+ ShellBang => \&shellBang,
336
+ pager => \&pager,
337
+ signalLevel => \&signalLevel,
338
+ warnLevel => \&warnLevel,
339
+ dieLevel => \&dieLevel,
340
+ tkRunning => \&tkRunning,
341
+ ornaments => \&ornaments,
342
+ RemotePort => \&RemotePort,
343
+ DollarCaretP => \&DollarCaretP,
344
+ OnlyAssertions=> \&OnlyAssertions,
345
+ );
346
+
347
+ =pod
348
+
349
+ Last, the C<%optionRequire> notes modules that must be C<require>d if an
350
+ option is used.
351
+
352
+ =cut
353
+
354
+ # Note that this list is not complete: several options not listed here
355
+ # actually require that dumpvar.pl be loaded for them to work, but are
356
+ # not in the table. A subsequent patch will correct this problem; for
357
+ # the moment, we're just recommenting, and we are NOT going to change
358
+ # function.
359
+ %optionRequire = (
360
+ compactDump => 'dumpvar.pl',
361
+ veryCompact => 'dumpvar.pl',
362
+ quote => 'dumpvar.pl',
363
+ );
364
+
365
+ =pod
366
+
367
+ There are a number of initialization-related variables which can be set
368
+ by putting code to set them in a BEGIN block in the C<PERL5DB> environment
369
+ variable. These are:
370
+
371
+ =over 4
372
+
373
+ =item C<$rl> - readline control XXX needs more explanation
374
+
375
+ =item C<$warnLevel> - whether or not debugger takes over warning handling
376
+
377
+ =item C<$dieLevel> - whether or not debugger takes over die handling
378
+
379
+ =item C<$signalLevel> - whether or not debugger takes over signal handling
380
+
381
+ =item C<$pre> - preprompt actions (array reference)
382
+
383
+ =item C<$post> - postprompt actions (array reference)
384
+
385
+ =item C<$pretype>
386
+
387
+ =item C<$CreateTTY> - whether or not to create a new TTY for this debugger
388
+
389
+ =item C<$CommandSet> - which command set to use (defaults to new, documented set)
390
+
391
+ =back
392
+
393
+ =cut
394
+
395
+ # These guys may be defined in $ENV{PERL5DB} :
396
+ $rl = 1 unless defined $rl;
397
+ $warnLevel = 1 unless defined $warnLevel;
398
+ $dieLevel = 1 unless defined $dieLevel;
399
+ $signalLevel = 1 unless defined $signalLevel;
400
+ $pre = [] unless defined $pre;
401
+ $post = [] unless defined $post;
402
+ $pretype = [] unless defined $pretype;
403
+ $CreateTTY = 3 unless defined $CreateTTY;
404
+ $CommandSet = '580' unless defined $CommandSet;
405
+
406
+ share($rl);
407
+ share($warnLevel);
408
+ share($dieLevel);
409
+ share($signalLevel);
410
+ share($pre);
411
+ share($post);
412
+ share($pretype);
413
+ share($rl);
414
+ share($CreateTTY);
415
+ share($CommandSet);
416
+
417
+ =pod
418
+
419
+ The default C<die>, C<warn>, and C<signal> handlers are set up.
420
+
421
+ =cut
422
+
423
+ warnLevel($warnLevel);
424
+ dieLevel($dieLevel);
425
+ signalLevel($signalLevel);
426
+
427
+ =pod
428
+
429
+ The pager to be used is needed next. We try to get it from the
430
+ environment first. if it's not defined there, we try to find it in
431
+ the Perl C<Config.pm>. If it's not there, we default to C<more>. We
432
+ then call the C<pager()> function to save the pager name.
433
+
434
+ =cut
435
+
436
+ # This routine makes sure $pager is set up so that '|' can use it.
437
+ pager(
438
+
439
+ # If PAGER is defined in the environment, use it.
440
+ defined $ENV{PAGER}
441
+ ? $ENV{PAGER}
442
+
443
+ # If not, see if Config.pm defines it.
444
+ : eval { require Config }
445
+ && defined $Config::Config{pager}
446
+ ? $Config::Config{pager}
447
+
448
+ # If not, fall back to 'more'.
449
+ : 'more'
450
+ )
451
+ unless defined $pager;
452
+
453
+ =pod
454
+
455
+ We set up the command to be used to access the man pages, the command
456
+ recall character (C<!> unless otherwise defined) and the shell escape
457
+ character (C<!> unless otherwise defined). Yes, these do conflict, and
458
+ neither works in the debugger at the moment.
459
+
460
+ =cut
461
+
462
+ setman();
463
+
464
+ # Set up defaults for command recall and shell escape (note:
465
+ # these currently don't work in linemode debugging).
466
+ &recallCommand("!") unless defined $prc;
467
+ &shellBang("!") unless defined $psh;
468
+
469
+ =pod
470
+
471
+ We then set up the gigantic string containing the debugger help.
472
+ We also set the limit on the number of arguments we'll display during a
473
+ trace.
474
+
475
+ =cut
476
+
477
+ sethelp();
478
+
479
+ # If we didn't get a default for the length of eval/stack trace args,
480
+ # set it here.
481
+ $maxtrace = 400 unless defined $maxtrace;
482
+
483
+ =head2 SETTING UP THE DEBUGGER GREETING
484
+
485
+ The debugger I<greeting> helps to inform the user how many debuggers are
486
+ running, and whether the current debugger is the primary or a child.
487
+
488
+ If we are the primary, we just hang onto our pid so we'll have it when
489
+ or if we start a child debugger. If we are a child, we'll set things up
490
+ so we'll have a unique greeting and so the parent will give us our own
491
+ TTY later.
492
+
493
+ We save the current contents of the C<PERLDB_PIDS> environment variable
494
+ because we mess around with it. We'll also need to hang onto it because
495
+ we'll need it if we restart.
496
+
497
+ Child debuggers make a label out of the current PID structure recorded in
498
+ PERLDB_PIDS plus the new PID. They also mark themselves as not having a TTY
499
+ yet so the parent will give them one later via C<resetterm()>.
500
+
501
+ =cut
502
+
503
+ # Save the current contents of the environment; we're about to
504
+ # much with it. We'll need this if we have to restart.
505
+ $ini_pids = $ENV{PERLDB_PIDS};
506
+
507
+ if ( defined $ENV{PERLDB_PIDS} ) {
508
+
509
+ # We're a child. Make us a label out of the current PID structure
510
+ # recorded in PERLDB_PIDS plus our (new) PID. Mark us as not having
511
+ # a term yet so the parent will give us one later via resetterm().
512
+ $pids = "[$ENV{PERLDB_PIDS}]";
513
+ $ENV{PERLDB_PIDS} .= "->$$";
514
+ $term_pid = -1;
515
+ } ## end if (defined $ENV{PERLDB_PIDS...
516
+ else {
517
+
518
+ # We're the parent PID. Initialize PERLDB_PID in case we end up with a
519
+ # child debugger, and mark us as the parent, so we'll know to set up
520
+ # more TTY's is we have to.
521
+ $ENV{PERLDB_PIDS} = "$$";
522
+ $pids = "{pid=$$}";
523
+ $term_pid = $$;
524
+ }
525
+
526
+ $pidprompt = '';
527
+
528
+ # Sets up $emacs as a synonym for $slave_editor.
529
+ *emacs = $slave_editor if $slave_editor; # May be used in afterinit()...
530
+
531
+ =head2 READING THE RC FILE
532
+
533
+ The debugger will read a file of initialization options if supplied. If
534
+ running interactively, this is C<.perldb>; if not, it's C<perldb.ini>.
535
+
536
+ =cut
537
+
538
+ # As noted, this test really doesn't check accurately that the debugger
539
+ # is running at a terminal or not.
540
+
541
+ if ( -e "/dev/tty" ) { # this is the wrong metric!
542
+ $rcfile = ".perldb";
543
+ }
544
+ else {
545
+ $rcfile = "perldb.ini";
546
+ }
547
+
548
+ =pod
549
+
550
+ The debugger does a safety test of the file to be read. It must be owned
551
+ either by the current user or root, and must only be writable by the owner.
552
+
553
+ =cut
554
+
555
+ # This wraps a safety test around "do" to read and evaluate the init file.
556
+ #
557
+ # This isn't really safe, because there's a race
558
+ # between checking and opening. The solution is to
559
+ # open and fstat the handle, but then you have to read and
560
+ # eval the contents. But then the silly thing gets
561
+ # your lexical scope, which is unfortunate at best.
562
+ sub safe_do {
563
+ my $file = shift;
564
+
565
+ # Just exactly what part of the word "CORE::" don't you understand?
566
+ local $SIG{__WARN__};
567
+ local $SIG{__DIE__};
568
+
569
+ unless ( is_safe_file($file) ) {
570
+ CORE::warn <<EO_GRIPE;
571
+ perldb: Must not source insecure rcfile $file.
572
+ You or the superuser must be the owner, and it must not
573
+ be writable by anyone but its owner.
574
+ EO_GRIPE
575
+ return;
576
+ } ## end unless (is_safe_file($file...
577
+
578
+ do $file;
579
+ CORE::warn("perldb: couldn't parse $file: $@") if $@;
580
+ } ## end sub safe_do
581
+
582
+ # This is the safety test itself.
583
+ #
584
+ # Verifies that owner is either real user or superuser and that no
585
+ # one but owner may write to it. This function is of limited use
586
+ # when called on a path instead of upon a handle, because there are
587
+ # no guarantees that filename (by dirent) whose file (by ino) is
588
+ # eventually accessed is the same as the one tested.
589
+ # Assumes that the file's existence is not in doubt.
590
+ sub is_safe_file {
591
+ my $path = shift;
592
+ stat($path) || return; # mysteriously vaporized
593
+ my ( $dev, $ino, $mode, $nlink, $uid, $gid ) = stat(_);
594
+
595
+ return 0 if $uid != 0 && $uid != $<;
596
+ return 0 if $mode & 022;
597
+ return 1;
598
+ } ## end sub is_safe_file
599
+
600
+ # If the rcfile (whichever one we decided was the right one to read)
601
+ # exists, we safely do it.
602
+ if ( -f $rcfile ) {
603
+ safe_do("./$rcfile");
604
+ }
605
+
606
+ # If there isn't one here, try the user's home directory.
607
+ elsif ( defined $ENV{HOME} && -f "$ENV{HOME}/$rcfile" ) {
608
+ safe_do("$ENV{HOME}/$rcfile");
609
+ }
610
+
611
+ # Else try the login directory.
612
+ elsif ( defined $ENV{LOGDIR} && -f "$ENV{LOGDIR}/$rcfile" ) {
613
+ safe_do("$ENV{LOGDIR}/$rcfile");
614
+ }
615
+
616
+ # If the PERLDB_OPTS variable has options in it, parse those out next.
617
+ if ( defined $ENV{PERLDB_OPTS} ) {
618
+ parse_options( $ENV{PERLDB_OPTS} );
619
+ }
620
+
621
+ =pod
622
+
623
+ The last thing we do during initialization is determine which subroutine is
624
+ to be used to obtain a new terminal when a new debugger is started. Right now,
625
+ the debugger only handles X Windows and OS/2.
626
+
627
+ =cut
628
+
629
+ # Set up the get_fork_TTY subroutine to be aliased to the proper routine.
630
+ # Works if you're running an xterm or xterm-like window, or you're on
631
+ # OS/2. This may need some expansion: for instance, this doesn't handle
632
+ # OS X Terminal windows.
633
+
634
+ if (
635
+ not defined &get_fork_TTY # no routine exists,
636
+ and defined $ENV{TERM} # and we know what kind
637
+ # of terminal this is,
638
+ and $ENV{TERM} eq 'xterm' # and it's an xterm,
639
+ # and defined $ENV{WINDOWID} # and we know what window this is, <- wrong metric
640
+ and defined $ENV{DISPLAY} # and what display it's on,
641
+ )
642
+ {
643
+ *get_fork_TTY = \&xterm_get_fork_TTY; # use the xterm version
644
+ } ## end if (not defined &get_fork_TTY...
645
+ elsif ( $^O eq 'os2' ) { # If this is OS/2,
646
+ *get_fork_TTY = \&os2_get_fork_TTY; # use the OS/2 version
647
+ }
648
+
649
+ # untaint $^O, which may have been tainted by the last statement.
650
+ # see bug [perl #24674]
651
+ $^O =~ m/^(.*)\z/;
652
+ $^O = $1;
653
+
654
+ # Here begin the unreadable code. It needs fixing.
655
+
656
+ =head2 RESTART PROCESSING
657
+
658
+ This section handles the restart command. When the C<R> command is invoked, it
659
+ tries to capture all of the state it can into environment variables, and
660
+ then sets C<PERLDB_RESTART>. When we start executing again, we check to see
661
+ if C<PERLDB_RESTART> is there; if so, we reload all the information that
662
+ the R command stuffed into the environment variables.
663
+
664
+ PERLDB_RESTART - flag only, contains no restart data itself.
665
+ PERLDB_HIST - command history, if it's available
666
+ PERLDB_ON_LOAD - breakpoints set by the rc file
667
+ PERLDB_POSTPONE - subs that have been loaded/not executed, and have actions
668
+ PERLDB_VISITED - files that had breakpoints
669
+ PERLDB_FILE_... - breakpoints for a file
670
+ PERLDB_OPT - active options
671
+ PERLDB_INC - the original @INC
672
+ PERLDB_PRETYPE - preprompt debugger actions
673
+ PERLDB_PRE - preprompt Perl code
674
+ PERLDB_POST - post-prompt Perl code
675
+ PERLDB_TYPEAHEAD - typeahead captured by readline()
676
+
677
+ We chug through all these variables and plug the values saved in them
678
+ back into the appropriate spots in the debugger.
679
+
680
+ =cut
681
+
682
+ if ( exists $ENV{PERLDB_RESTART} ) {
683
+
684
+ # We're restarting, so we don't need the flag that says to restart anymore.
685
+ delete $ENV{PERLDB_RESTART};
686
+
687
+ # $restart = 1;
688
+ @hist = get_list('PERLDB_HIST');
689
+ %break_on_load = get_list("PERLDB_ON_LOAD");
690
+ %postponed = get_list("PERLDB_POSTPONE");
691
+
692
+ share(@hist);
693
+ share(@truehist);
694
+ share(%break_on_load);
695
+ share(%postponed);
696
+
697
+ # restore breakpoints/actions
698
+ my @had_breakpoints = get_list("PERLDB_VISITED");
699
+ for ( 0 .. $#had_breakpoints ) {
700
+ my %pf = get_list("PERLDB_FILE_$_");
701
+ $postponed_file{ $had_breakpoints[$_] } = \%pf if %pf;
702
+ }
703
+
704
+ # restore options
705
+ my %opt = get_list("PERLDB_OPT");
706
+ my ( $opt, $val );
707
+ while ( ( $opt, $val ) = each %opt ) {
708
+ $val =~ s/[\\\']/\\$1/g;
709
+ parse_options("$opt'$val'");
710
+ }
711
+
712
+ # restore original @INC
713
+ @INC = get_list("PERLDB_INC");
714
+ @ini_INC = @INC;
715
+
716
+ # return pre/postprompt actions and typeahead buffer
717
+ $pretype = [ get_list("PERLDB_PRETYPE") ];
718
+ $pre = [ get_list("PERLDB_PRE") ];
719
+ $post = [ get_list("PERLDB_POST") ];
720
+ @typeahead = get_list( "PERLDB_TYPEAHEAD", @typeahead );
721
+ } ## end if (exists $ENV{PERLDB_RESTART...
722
+
723
+ =head2 SETTING UP THE TERMINAL
724
+
725
+ Now, we'll decide how the debugger is going to interact with the user.
726
+ If there's no TTY, we set the debugger to run non-stop; there's not going
727
+ to be anyone there to enter commands.
728
+
729
+ =cut
730
+
731
+ if ($notty) {
732
+ $runnonstop = 1;
733
+ share($runnonstop);
734
+ }
735
+
736
+ =pod
737
+
738
+ If there is a TTY, we have to determine who it belongs to before we can
739
+ proceed. If this is a slave editor or graphical debugger (denoted by
740
+ the first command-line switch being '-emacs'), we shift this off and
741
+ set C<$rl> to 0 (XXX ostensibly to do straight reads).
742
+
743
+ =cut
744
+
745
+ else {
746
+
747
+ # Is Perl being run from a slave editor or graphical debugger?
748
+ # If so, don't use readline, and set $slave_editor = 1.
749
+ $slave_editor =
750
+ ( ( defined $main::ARGV[0] ) and ( $main::ARGV[0] eq '-emacs' ) );
751
+ $rl = 0, shift(@main::ARGV) if $slave_editor;
752
+
753
+ #require Term::ReadLine;
754
+
755
+ =pod
756
+
757
+ We then determine what the console should be on various systems:
758
+
759
+ =over 4
760
+
761
+ =item * Cygwin - We use C<stdin> instead of a separate device.
762
+
763
+ =cut
764
+
765
+ if ( $^O eq 'cygwin' ) {
766
+
767
+ # /dev/tty is binary. use stdin for textmode
768
+ undef $console;
769
+ }
770
+
771
+ =item * Unix - use C</dev/tty>.
772
+
773
+ =cut
774
+
775
+ elsif ( -e "/dev/tty" ) {
776
+ $console = "/dev/tty";
777
+ }
778
+
779
+ =item * Windows or MSDOS - use C<con>.
780
+
781
+ =cut
782
+
783
+ elsif ( $^O eq 'dos' or -e "con" or $^O eq 'MSWin32' ) {
784
+ $console = "con";
785
+ }
786
+
787
+ =item * MacOS - use C<Dev:Console:Perl Debug> if this is the MPW version; C<Dev:
788
+ Console> if not.
789
+
790
+ Note that Mac OS X returns C<darwin>, not C<MacOS>. Also note that the debugger doesn't do anything special for C<darwin>. Maybe it should.
791
+
792
+ =cut
793
+
794
+ elsif ( $^O eq 'MacOS' ) {
795
+ if ( $MacPerl::Version !~ /MPW/ ) {
796
+ $console =
797
+ "Dev:Console:Perl Debug"; # Separate window for application
798
+ }
799
+ else {
800
+ $console = "Dev:Console";
801
+ }
802
+ } ## end elsif ($^O eq 'MacOS')
803
+
804
+ =item * VMS - use C<sys$command>.
805
+
806
+ =cut
807
+
808
+ else {
809
+
810
+ # everything else is ...
811
+ $console = "sys\$command";
812
+ }
813
+
814
+ =pod
815
+
816
+ =back
817
+
818
+ Several other systems don't use a specific console. We C<undef $console>
819
+ for those (Windows using a slave editor/graphical debugger, NetWare, OS/2
820
+ with a slave editor, Epoc).
821
+
822
+ =cut
823
+
824
+ if ( ( $^O eq 'MSWin32' ) and ( $slave_editor or defined $ENV{EMACS} ) ) {
825
+
826
+ # /dev/tty is binary. use stdin for textmode
827
+ $console = undef;
828
+ }
829
+
830
+ if ( $^O eq 'NetWare' ) {
831
+
832
+ # /dev/tty is binary. use stdin for textmode
833
+ $console = undef;
834
+ }
835
+
836
+ # In OS/2, we need to use STDIN to get textmode too, even though
837
+ # it pretty much looks like Unix otherwise.
838
+ if ( defined $ENV{OS2_SHELL} and ( $slave_editor or $ENV{WINDOWID} ) )
839
+ { # In OS/2
840
+ $console = undef;
841
+ }
842
+
843
+ # EPOC also falls into the 'got to use STDIN' camp.
844
+ if ( $^O eq 'epoc' ) {
845
+ $console = undef;
846
+ }
847
+
848
+ =pod
849
+
850
+ If there is a TTY hanging around from a parent, we use that as the console.
851
+
852
+ =cut
853
+
854
+ $console = $tty if defined $tty;
855
+
856
+ =head2 SOCKET HANDLING
857
+
858
+ The debugger is capable of opening a socket and carrying out a debugging
859
+ session over the socket.
860
+
861
+ If C<RemotePort> was defined in the options, the debugger assumes that it
862
+ should try to start a debugging session on that port. It builds the socket
863
+ and then tries to connect the input and output filehandles to it.
864
+
865
+ =cut
866
+
867
+ # Handle socket stuff.
868
+
869
+ if ( defined $remoteport ) {
870
+
871
+ # If RemotePort was defined in the options, connect input and output
872
+ # to the socket.
873
+ require IO::Socket;
874
+ $OUT = new IO::Socket::INET(
875
+ Timeout => '10',
876
+ PeerAddr => $remoteport,
877
+ Proto => 'tcp',
878
+ );
879
+ if ( !$OUT ) { die "Unable to connect to remote host: $remoteport\n"; }
880
+ $IN = $OUT;
881
+ } ## end if (defined $remoteport)
882
+
883
+ =pod
884
+
885
+ If no C<RemotePort> was defined, and we want to create a TTY on startup,
886
+ this is probably a situation where multiple debuggers are running (for example,
887
+ a backticked command that starts up another debugger). We create a new IN and
888
+ OUT filehandle, and do the necessary mojo to create a new TTY if we know how
889
+ and if we can.
890
+
891
+ =cut
892
+
893
+ # Non-socket.
894
+ else {
895
+
896
+ # Two debuggers running (probably a system or a backtick that invokes
897
+ # the debugger itself under the running one). create a new IN and OUT
898
+ # filehandle, and do the necessary mojo to create a new tty if we
899
+ # know how, and we can.
900
+ create_IN_OUT(4) if $CreateTTY & 4;
901
+ if ($console) {
902
+
903
+ # If we have a console, check to see if there are separate ins and
904
+ # outs to open. (They are assumed identiical if not.)
905
+
906
+ my ( $i, $o ) = split /,/, $console;
907
+ $o = $i unless defined $o;
908
+
909
+ # read/write on in, or just read, or read on STDIN.
910
+ open( IN, "+<$i" )
911
+ || open( IN, "<$i" )
912
+ || open( IN, "<&STDIN" );
913
+
914
+ # read/write/create/clobber out, or write/create/clobber out,
915
+ # or merge with STDERR, or merge with STDOUT.
916
+ open( OUT, "+>$o" )
917
+ || open( OUT, ">$o" )
918
+ || open( OUT, ">&STDERR" )
919
+ || open( OUT, ">&STDOUT" ); # so we don't dongle stdout
920
+
921
+ } ## end if ($console)
922
+ elsif ( not defined $console ) {
923
+
924
+ # No console. Open STDIN.
925
+ open( IN, "<&STDIN" );
926
+
927
+ # merge with STDERR, or with STDOUT.
928
+ open( OUT, ">&STDERR" )
929
+ || open( OUT, ">&STDOUT" ); # so we don't dongle stdout
930
+ $console = 'STDIN/OUT';
931
+ } ## end elsif (not defined $console)
932
+
933
+ # Keep copies of the filehandles so that when the pager runs, it
934
+ # can close standard input without clobbering ours.
935
+ $IN = \*IN, $OUT = \*OUT if $console or not defined $console;
936
+ } ## end elsif (from if(defined $remoteport))
937
+
938
+ # Unbuffer DB::OUT. We need to see responses right away.
939
+ my $previous = select($OUT);
940
+ $| = 1; # for DB::OUT
941
+ select($previous);
942
+
943
+ # Line info goes to debugger output unless pointed elsewhere.
944
+ # Pointing elsewhere makes it possible for slave editors to
945
+ # keep track of file and position. We have both a filehandle
946
+ # and a I/O description to keep track of.
947
+ $LINEINFO = $OUT unless defined $LINEINFO;
948
+ $lineinfo = $console unless defined $lineinfo;
949
+ # share($LINEINFO); # <- unable to share globs
950
+ share($lineinfo); #
951
+
952
+ =pod
953
+
954
+ To finish initialization, we show the debugger greeting,
955
+ and then call the C<afterinit()> subroutine if there is one.
956
+
957
+ =cut
958
+
959
+ # Show the debugger greeting.
960
+ $header =~ s/.Header: ([^,]+),v(\s+\S+\s+\S+).*$/$1$2/;
961
+ unless ($runnonstop) {
962
+ local $\ = '';
963
+ local $, = '';
964
+ if ( $term_pid eq '-1' ) {
965
+ print $OUT "\nDaughter DB session started...\n";
966
+ }
967
+ else {
968
+ print $OUT "\nLoading DB routines from $header\n";
969
+ print $OUT (
970
+ "Editor support ",
971
+ $slave_editor ? "enabled" : "available", ".\n"
972
+ );
973
+ print $OUT
974
+ "\nEnter h or `h h' for help, or `$doccmd perldebug' for more help.\n\n";
975
+ } ## end else [ if ($term_pid eq '-1')
976
+ } ## end unless ($runnonstop)
977
+ } ## end else [ if ($notty)
978
+
979
+ # XXX This looks like a bug to me.
980
+ # Why copy to @ARGS and then futz with @args?
981
+ @ARGS = @ARGV;
982
+ for (@args) {
983
+ # Make sure backslashes before single quotes are stripped out, and
984
+ # keep args unless they are numeric (XXX why?)
985
+ # s/\'/\\\'/g; # removed while not justified understandably
986
+ # s/(.*)/'$1'/ unless /^-?[\d.]+$/; # ditto
987
+ }
988
+
989
+ # If there was an afterinit() sub defined, call it. It will get
990
+ # executed in our scope, so it can fiddle with debugger globals.
991
+ if ( defined &afterinit ) { # May be defined in $rcfile
992
+ &afterinit();
993
+ }
994
+
995
+ # Inform us about "Stack dump during die enabled ..." in dieLevel().
996
+ $I_m_init = 1;
997
+
998
+