gitlab-pygments.rb 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/README.md +91 -0
- data/Rakefile +78 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +344 -0
- data/lib/pygments/popen.rb +389 -0
- data/lib/pygments/version.rb +3 -0
- data/lib/pygments.rb +8 -0
- data/pygments.rb.gemspec +24 -0
- data/test/test_data.c +2581 -0
- data/test/test_data.py +514 -0
- data/test/test_data_generated +2582 -0
- data/test/test_pygments.rb +276 -0
- data/vendor/custom_formatters/gitlab.py +171 -0
- data/vendor/custom_lexers/github.py +362 -0
- data/vendor/pygments-main/AUTHORS +115 -0
- data/vendor/pygments-main/CHANGES +762 -0
- data/vendor/pygments-main/LICENSE +25 -0
- data/vendor/pygments-main/MANIFEST.in +6 -0
- data/vendor/pygments-main/Makefile +59 -0
- data/vendor/pygments-main/REVISION +1 -0
- data/vendor/pygments-main/TODO +15 -0
- data/vendor/pygments-main/docs/generate.py +472 -0
- data/vendor/pygments-main/docs/pygmentize.1 +94 -0
- data/vendor/pygments-main/docs/src/api.txt +270 -0
- data/vendor/pygments-main/docs/src/authors.txt +5 -0
- data/vendor/pygments-main/docs/src/changelog.txt +5 -0
- data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
- data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
- data/vendor/pygments-main/docs/src/filters.txt +42 -0
- data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
- data/vendor/pygments-main/docs/src/formatters.txt +48 -0
- data/vendor/pygments-main/docs/src/index.txt +69 -0
- data/vendor/pygments-main/docs/src/installation.txt +71 -0
- data/vendor/pygments-main/docs/src/integrate.txt +43 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +551 -0
- data/vendor/pygments-main/docs/src/lexers.txt +67 -0
- data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
- data/vendor/pygments-main/docs/src/plugins.txt +93 -0
- data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
- data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
- data/vendor/pygments-main/docs/src/styles.txt +143 -0
- data/vendor/pygments-main/docs/src/tokens.txt +349 -0
- data/vendor/pygments-main/docs/src/unicode.txt +49 -0
- data/vendor/pygments-main/external/markdown-processor.py +67 -0
- data/vendor/pygments-main/external/moin-parser.py +112 -0
- data/vendor/pygments-main/external/pygments.bashcomp +38 -0
- data/vendor/pygments-main/external/rst-directive-old.py +77 -0
- data/vendor/pygments-main/external/rst-directive.py +83 -0
- data/vendor/pygments-main/ez_setup.py +276 -0
- data/vendor/pygments-main/pygmentize +7 -0
- data/vendor/pygments-main/pygments/__init__.py +91 -0
- data/vendor/pygments-main/pygments/cmdline.py +433 -0
- data/vendor/pygments-main/pygments/console.py +74 -0
- data/vendor/pygments-main/pygments/filter.py +74 -0
- data/vendor/pygments-main/pygments/filters/__init__.py +357 -0
- data/vendor/pygments-main/pygments/formatter.py +92 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +94 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/gitlab.py +171 -0
- data/vendor/pygments-main/pygments/formatters/html.py +750 -0
- data/vendor/pygments-main/pygments/formatters/img.py +553 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
- data/vendor/pygments-main/pygments/formatters/other.py +117 -0
- data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
- data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
- data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
- data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
- data/vendor/pygments-main/pygments/lexer.py +697 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +229 -0
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +298 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +29 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +3 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +1803 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +360 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +2891 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +636 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1832 -0
- data/vendor/pygments-main/pygments/lexers/github.py +362 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +847 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3339 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +695 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +361 -0
- data/vendor/pygments-main/pygments/lexers/special.py +100 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +1631 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1753 -0
- data/vendor/pygments-main/pygments/lexers/web.py +2864 -0
- data/vendor/pygments-main/pygments/plugin.py +74 -0
- data/vendor/pygments-main/pygments/scanner.py +104 -0
- data/vendor/pygments-main/pygments/style.py +117 -0
- data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
- data/vendor/pygments-main/pygments/styles/borland.py +51 -0
- data/vendor/pygments-main/pygments/styles/bw.py +49 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
- data/vendor/pygments-main/pygments/styles/default.py +73 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
- data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
- data/vendor/pygments-main/pygments/styles/manni.py +75 -0
- data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
- data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
- data/vendor/pygments-main/pygments/styles/native.py +65 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
- data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
- data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
- data/vendor/pygments-main/pygments/styles/tango.py +141 -0
- data/vendor/pygments-main/pygments/styles/trac.py +63 -0
- data/vendor/pygments-main/pygments/styles/vim.py +63 -0
- data/vendor/pygments-main/pygments/styles/vs.py +38 -0
- data/vendor/pygments-main/pygments/token.py +195 -0
- data/vendor/pygments-main/pygments/unistring.py +130 -0
- data/vendor/pygments-main/pygments/util.py +232 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +30 -0
- data/vendor/pygments-main/scripts/epydoc.css +280 -0
- data/vendor/pygments-main/scripts/find_codetags.py +205 -0
- data/vendor/pygments-main/scripts/find_error.py +171 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
- data/vendor/pygments-main/scripts/pylintrc +301 -0
- data/vendor/pygments-main/scripts/reindent.py +291 -0
- data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
- data/vendor/pygments-main/setup.cfg +6 -0
- data/vendor/pygments-main/setup.py +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
- data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
- data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
- data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
- data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
- data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
- data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
- data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
- data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +40 -0
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
- data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
- data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
- data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
- data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
- data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
- data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
- data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
- data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
- data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
- data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
- data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
- data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
- data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
- data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
- data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +14 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
- data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
- data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
- data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
- data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +27 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
- data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +25 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
- data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
- data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
- data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
- data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
- data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
- data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
- data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +119 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
- data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
- data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
- data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
- data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
- data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
- data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
- data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
- data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
- data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
- data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
- data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
- data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
- data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
- data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
- data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
- data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
- data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
- data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
- data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
- data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
- data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
- data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
- data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
- data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
- data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
- data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
- data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
- data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
- data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
- data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
- data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1202 -0
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
- data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
- data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
- data/vendor/pygments-main/tests/old_run.py +138 -0
- data/vendor/pygments-main/tests/run.py +48 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/test_basic_api.py +294 -0
- data/vendor/pygments-main/tests/test_clexer.py +31 -0
- data/vendor/pygments-main/tests/test_cmdline.py +105 -0
- data/vendor/pygments-main/tests/test_examplefiles.py +97 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +162 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
- data/vendor/pygments-main/tests/test_perllexer.py +137 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
- data/vendor/pygments-main/tests/test_token.py +46 -0
- data/vendor/pygments-main/tests/test_using_api.py +40 -0
- data/vendor/pygments-main/tests/test_util.py +116 -0
- data/vendor/simplejson/.gitignore +10 -0
- data/vendor/simplejson/.travis.yml +5 -0
- data/vendor/simplejson/CHANGES.txt +291 -0
- data/vendor/simplejson/LICENSE.txt +19 -0
- data/vendor/simplejson/MANIFEST.in +5 -0
- data/vendor/simplejson/README.rst +19 -0
- data/vendor/simplejson/conf.py +179 -0
- data/vendor/simplejson/index.rst +628 -0
- data/vendor/simplejson/scripts/make_docs.py +18 -0
- data/vendor/simplejson/setup.py +104 -0
- data/vendor/simplejson/simplejson/__init__.py +510 -0
- data/vendor/simplejson/simplejson/_speedups.c +2745 -0
- data/vendor/simplejson/simplejson/decoder.py +425 -0
- data/vendor/simplejson/simplejson/encoder.py +567 -0
- data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
- data/vendor/simplejson/simplejson/scanner.py +77 -0
- data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
- data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
- data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
- data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
- data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
- data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
- data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
- data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
- data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
- data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
- data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
- data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
- data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
- data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
- data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
- data/vendor/simplejson/simplejson/tool.py +39 -0
- metadata +492 -0
@@ -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
|
+
|