pygments.rb-jruby 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile +2 -0
- data/LICENSE +17 -0
- data/README.md +118 -0
- data/Rakefile +66 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments.rb +8 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +351 -0
- data/lib/pygments/popen.rb +404 -0
- data/lib/pygments/version.rb +3 -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 +287 -0
- data/vendor/custom_lexers/github.py +565 -0
- data/vendor/pygments-main/AUTHORS +153 -0
- data/vendor/pygments-main/CHANGES +889 -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 +48 -0
- data/vendor/pygments-main/docs/src/java.txt +70 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -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/autopygmentize +64 -0
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -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 +441 -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 +356 -0
- data/vendor/pygments-main/pygments/formatter.py +95 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/html.py +821 -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 +115 -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 +765 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +240 -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/_lassobuiltins.py +5172 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
- data/vendor/pygments-main/pygments/lexers/github.py +565 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +424 -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 +1742 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
- data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
- data/vendor/pygments-main/pygments/modeline.py +40 -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 +140 -0
- data/vendor/pygments-main/pygments/util.py +277 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -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 +170 -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 +7 -0
- data/vendor/pygments-main/setup.py +90 -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/BOM.js +1 -0
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -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/Deflate.fs +578 -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/Get-CommandDefinitionHtml.ps1 +66 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -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/RoleQ.pm6 +23 -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/autoit_submit.au3 +25 -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/bigtest.nsi +308 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
- data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -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 +125 -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.Rd +78 -0
- data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
- data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -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.hx +142 -0
- data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
- data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -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.msc +43 -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.prg +161 -0
- data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
- data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -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.stan +108 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.ts +28 -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.xtend +34 -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/example2.msc +79 -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/garcia-wachs.kk +133 -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/grammar-test.p6 +22 -0
- data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
- data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -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/json.lasso +301 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -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/livescript-demo.ls +41 -0
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -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 +30 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
- data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -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/nanomsg.intr +95 -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 +32 -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/phpMyAdmin.spec +163 -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/py3tb_test.py3tb +4 -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/pytb_test3.pytb +4 -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/robotframework.txt +39 -0
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -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/swig_java.swg +1329 -0
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
- data/vendor/pygments-main/tests/examplefiles/test.agda +102 -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.bb +95 -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.cu +36 -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.ebnf +31 -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.opa +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -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/test2.pypylog +120 -0
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -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/unix-io.lid +37 -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 +49 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/support/tags +36 -0
- data/vendor/pygments-main/tests/test_basic_api.py +295 -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 +99 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
- data/vendor/pygments-main/tests/test_lexers_other.py +68 -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 +135 -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 +557 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
/* This file /* which is totally legal scala */ will not be highlighted
|
2
|
+
correcty by pygments */
|
3
|
+
|
4
|
+
object ⌘ {
|
5
|
+
val `interface` = """
|
6
|
+
A
|
7
|
+
"Multiline"
|
8
|
+
String
|
9
|
+
"""
|
10
|
+
|
11
|
+
val foo_+ = "foo plus"
|
12
|
+
val foo_⌬⌬ = "double benzene"
|
13
|
+
|
14
|
+
def main(argv: Array[String]) {
|
15
|
+
println(⌘.interface + " " + foo_+ + " " + foo_⌬⌬ )
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
@@ -0,0 +1,174 @@
|
|
1
|
+
/*
|
2
|
+
* This file is part of the Hybris programming language.
|
3
|
+
*
|
4
|
+
* Copyleft of Francesco Morucci aka merlok <merlok@ihteam.net>
|
5
|
+
*
|
6
|
+
* Hybris is free software: you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
9
|
+
* (at your option) any later version.
|
10
|
+
*
|
11
|
+
* Hybris is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with Hybris. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
import std.io.file;
|
20
|
+
|
21
|
+
class File {
|
22
|
+
|
23
|
+
protected file, fileName, mode;
|
24
|
+
|
25
|
+
public method File( fileName, mode ){
|
26
|
+
me.fileName = fileName;
|
27
|
+
me.mode = mode;
|
28
|
+
me.file = fopen ( me.fileName, me.mode);
|
29
|
+
}
|
30
|
+
|
31
|
+
private method isBinary(){
|
32
|
+
return me.mode.find("b") != false;
|
33
|
+
}
|
34
|
+
|
35
|
+
public method File ( file ){
|
36
|
+
me.file = file;
|
37
|
+
}
|
38
|
+
|
39
|
+
private method __expire() {
|
40
|
+
me.close();
|
41
|
+
}
|
42
|
+
|
43
|
+
public method close(){
|
44
|
+
fclose( me.file );
|
45
|
+
}
|
46
|
+
|
47
|
+
public method readLine(){
|
48
|
+
return line = fgets( me.file );
|
49
|
+
}
|
50
|
+
|
51
|
+
public method getFileName(){
|
52
|
+
return me.fileName;
|
53
|
+
}
|
54
|
+
|
55
|
+
public method getSize(){
|
56
|
+
return fsize( me.fileName );
|
57
|
+
}
|
58
|
+
|
59
|
+
public method getPosition(){
|
60
|
+
return ftell( me.file );
|
61
|
+
}
|
62
|
+
|
63
|
+
public method readAll(){
|
64
|
+
text = "";
|
65
|
+
line = "";
|
66
|
+
while ( ( line = fgets(me.file) ) != 0 ){
|
67
|
+
text += line;
|
68
|
+
}
|
69
|
+
return text;
|
70
|
+
}
|
71
|
+
|
72
|
+
public method read(){
|
73
|
+
byte = ' ';
|
74
|
+
if ( fread( me.file, byte) > 0 ) {
|
75
|
+
return byte;
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
return -1;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
public method read( bytes ) {
|
83
|
+
word = "";
|
84
|
+
byte = ' ';
|
85
|
+
if ( fread( me.file, byte, bytes) > 0 ) {
|
86
|
+
word += byte;
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
return -1;
|
90
|
+
}
|
91
|
+
return word;
|
92
|
+
}
|
93
|
+
|
94
|
+
public method read ( seek, seekType ){
|
95
|
+
if ( me.seek( seek, seekType) == 0 ) {
|
96
|
+
return -1;
|
97
|
+
}
|
98
|
+
|
99
|
+
return me.read();
|
100
|
+
}
|
101
|
+
|
102
|
+
public method read ( bytes, seek, seekType ){
|
103
|
+
if ( me.seek( seek, seekType) == 0 ) {
|
104
|
+
return -1;
|
105
|
+
}
|
106
|
+
|
107
|
+
return me.read( bytes );
|
108
|
+
}
|
109
|
+
|
110
|
+
public method readType ( type ){
|
111
|
+
if ( me.isBinary() == false ) {
|
112
|
+
return -1;
|
113
|
+
}
|
114
|
+
if ( fread (me.file, type ) > 0 ) {
|
115
|
+
return type;
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
return -1;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
operator >> ( object ){
|
123
|
+
return me.readType(object);
|
124
|
+
}
|
125
|
+
|
126
|
+
public method readType ( type, bytes ){
|
127
|
+
if ( me.isBinary() == false ) {
|
128
|
+
return -1;
|
129
|
+
}
|
130
|
+
if ( fread (me.file, type, bytes ) > 0){
|
131
|
+
return type;
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
return -1;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
public method readType ( type, seek, seekType ){
|
139
|
+
if ( ( me.isBinary() == false ) | ( me.seek( seek, seekType) == 0 ) ) {
|
140
|
+
return -1;
|
141
|
+
}
|
142
|
+
|
143
|
+
return me.readType( type );
|
144
|
+
}
|
145
|
+
|
146
|
+
public method readType( type, bytes, seek, seekType){
|
147
|
+
if ( ( me.isBinary() == false ) | ( me.seek( seek, seekType) == 0 ) ) {
|
148
|
+
return -1;
|
149
|
+
}
|
150
|
+
|
151
|
+
return me.readType( type, bytes );
|
152
|
+
}
|
153
|
+
|
154
|
+
public method write( data ){
|
155
|
+
return fwrite( me.file, data );
|
156
|
+
}
|
157
|
+
|
158
|
+
operator << ( object ){
|
159
|
+
return me.write(object);
|
160
|
+
}
|
161
|
+
|
162
|
+
public method write ( data, bytes ){
|
163
|
+
return fwrite( me.file, data, bytes);
|
164
|
+
}
|
165
|
+
|
166
|
+
public method seek( pos, mode ){
|
167
|
+
return fseek( me.file, pos, mode );
|
168
|
+
}
|
169
|
+
|
170
|
+
public method merge ( fileName ){
|
171
|
+
text = file ( fileName );
|
172
|
+
return me.write ( me.file, text );
|
173
|
+
}
|
174
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
function Get-CommandDefinitionHtml {
|
3
|
+
|
4
|
+
# this tells powershell to allow advanced features,
|
5
|
+
# like the [validatenotnullorempty()] attribute below.
|
6
|
+
[CmdletBinding()]
|
7
|
+
param(
|
8
|
+
[ValidateNotNullOrEmpty()]
|
9
|
+
[string]$name
|
10
|
+
)
|
11
|
+
|
12
|
+
$command = get-command $name
|
13
|
+
|
14
|
+
# Look mom! I'm a cmdlet!
|
15
|
+
$PSCmdlet.WriteVerbose("Dumping HTML for " + $command)
|
16
|
+
|
17
|
+
@"
|
18
|
+
<html>
|
19
|
+
<head>
|
20
|
+
<title>$($command.name)</title>
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<table border="1">
|
24
|
+
$(
|
25
|
+
$command.parametersets | % {
|
26
|
+
@"
|
27
|
+
|
28
|
+
<tr>
|
29
|
+
<td>$($_.name)</td>
|
30
|
+
<td>
|
31
|
+
<table border="1">
|
32
|
+
<tr>
|
33
|
+
<th colspan="8">Parameters</th>
|
34
|
+
|
35
|
+
$(
|
36
|
+
$count = 0
|
37
|
+
$_.parameters | % {
|
38
|
+
if (0 -eq ($count % 8)) {
|
39
|
+
@'
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
'@
|
43
|
+
}
|
44
|
+
@"
|
45
|
+
<td>$($_.name)</td>
|
46
|
+
"@
|
47
|
+
$count++
|
48
|
+
}
|
49
|
+
)
|
50
|
+
</tr>
|
51
|
+
</table>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
"@
|
55
|
+
}
|
56
|
+
)
|
57
|
+
</table>
|
58
|
+
</body>
|
59
|
+
</html>
|
60
|
+
"@
|
61
|
+
}
|
62
|
+
|
63
|
+
Get-CommandDefinitionHtml get-item > out.html
|
64
|
+
|
65
|
+
# show in browser
|
66
|
+
invoke-item out.html
|
@@ -0,0 +1,104 @@
|
|
1
|
+
/*
|
2
|
+
* "Copyright (c) 2008-2011 The Regents of the University of California.
|
3
|
+
* All rights reserved."
|
4
|
+
*
|
5
|
+
* Permission to use, copy, modify, and distribute this software and its
|
6
|
+
* documentation for any purpose, without fee, and without written agreement is
|
7
|
+
* hereby granted, provided that the above copyright notice, the following
|
8
|
+
* two paragraphs and the author appear in all copies of this software.
|
9
|
+
*
|
10
|
+
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
11
|
+
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
12
|
+
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
13
|
+
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14
|
+
*
|
15
|
+
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
16
|
+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
17
|
+
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
18
|
+
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
19
|
+
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
/**
|
24
|
+
*
|
25
|
+
*
|
26
|
+
*/
|
27
|
+
#include "IPDispatch.h"
|
28
|
+
#include "BlipStatistics.h"
|
29
|
+
|
30
|
+
configuration IPDispatchC {
|
31
|
+
provides {
|
32
|
+
interface SplitControl;
|
33
|
+
interface IPLower;
|
34
|
+
interface BlipStatistics<ip_statistics_t>;
|
35
|
+
}
|
36
|
+
} implementation {
|
37
|
+
|
38
|
+
components MainC;
|
39
|
+
components NoLedsC as LedsC;
|
40
|
+
|
41
|
+
/* IPDispatchP wiring -- fragment rassembly and lib6lowpan bindings */
|
42
|
+
components IPDispatchP;
|
43
|
+
components CC2420RadioC as MessageC;
|
44
|
+
components ReadLqiC;
|
45
|
+
components new TimerMilliC();
|
46
|
+
|
47
|
+
SplitControl = IPDispatchP.SplitControl;
|
48
|
+
IPLower = IPDispatchP;
|
49
|
+
BlipStatistics = IPDispatchP;
|
50
|
+
|
51
|
+
IPDispatchP.Boot -> MainC;
|
52
|
+
/* #else */
|
53
|
+
/* components ResourceSendP; */
|
54
|
+
/* ResourceSendP.SubSend -> MessageC; */
|
55
|
+
/* ResourceSendP.Resource -> MessageC.SendResource[unique("RADIO_SEND_RESOURCE")]; */
|
56
|
+
/* IPDispatchP.Ieee154Send -> ResourceSendP.Ieee154Send; */
|
57
|
+
/* #endif */
|
58
|
+
IPDispatchP.RadioControl -> MessageC;
|
59
|
+
|
60
|
+
IPDispatchP.BarePacket -> MessageC.BarePacket;
|
61
|
+
IPDispatchP.Ieee154Send -> MessageC.BareSend;
|
62
|
+
IPDispatchP.Ieee154Receive -> MessageC.BareReceive;
|
63
|
+
|
64
|
+
#ifdef LOW_POWER_LISTENING
|
65
|
+
IPDispatchP.LowPowerListening -> MessageC;
|
66
|
+
#endif
|
67
|
+
MainC.SoftwareInit -> IPDispatchP.Init;
|
68
|
+
|
69
|
+
IPDispatchP.PacketLink -> MessageC;
|
70
|
+
IPDispatchP.ReadLqi -> ReadLqiC;
|
71
|
+
IPDispatchP.Leds -> LedsC;
|
72
|
+
IPDispatchP.ExpireTimer -> TimerMilliC;
|
73
|
+
|
74
|
+
components new PoolC(message_t, N_FRAGMENTS) as FragPool;
|
75
|
+
components new PoolC(struct send_entry, N_FRAGMENTS) as SendEntryPool;
|
76
|
+
components new QueueC(struct send_entry *, N_FRAGMENTS);
|
77
|
+
components new PoolC(struct send_info, N_CONCURRENT_SENDS) as SendInfoPool;
|
78
|
+
|
79
|
+
IPDispatchP.FragPool -> FragPool;
|
80
|
+
IPDispatchP.SendEntryPool -> SendEntryPool;
|
81
|
+
IPDispatchP.SendInfoPool -> SendInfoPool;
|
82
|
+
IPDispatchP.SendQueue -> QueueC;
|
83
|
+
|
84
|
+
components IPNeighborDiscoveryP;
|
85
|
+
IPDispatchP.NeighborDiscovery -> IPNeighborDiscoveryP;
|
86
|
+
|
87
|
+
/* components ICMPResponderC; */
|
88
|
+
/* #ifdef BLIP_MULTICAST */
|
89
|
+
/* components MulticastP; */
|
90
|
+
/* components new TrickleTimerMilliC(2, 30, 2, 1); */
|
91
|
+
/* IP = MulticastP.IP; */
|
92
|
+
|
93
|
+
/* MainC.SoftwareInit -> MulticastP.Init; */
|
94
|
+
/* MulticastP.MulticastRx -> IPDispatchP.Multicast; */
|
95
|
+
/* MulticastP.HopHeader -> IPExtensionP.HopByHopExt[0]; */
|
96
|
+
/* MulticastP.TrickleTimer -> TrickleTimerMilliC.TrickleTimer[0]; */
|
97
|
+
/* MulticastP.IPExtensions -> IPDispatchP; */
|
98
|
+
/* #endif */
|
99
|
+
|
100
|
+
#ifdef DELUGE
|
101
|
+
components NWProgC;
|
102
|
+
#endif
|
103
|
+
|
104
|
+
}
|
@@ -0,0 +1,671 @@
|
|
1
|
+
/*
|
2
|
+
* "Copyright (c) 2008 The Regents of the University of California.
|
3
|
+
* All rights reserved."
|
4
|
+
*
|
5
|
+
* Permission to use, copy, modify, and distribute this software and its
|
6
|
+
* documentation for any purpose, without fee, and without written agreement is
|
7
|
+
* hereby granted, provided that the above copyright notice, the following
|
8
|
+
* two paragraphs and the author appear in all copies of this software.
|
9
|
+
*
|
10
|
+
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
11
|
+
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
12
|
+
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
13
|
+
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14
|
+
*
|
15
|
+
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
16
|
+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
17
|
+
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
18
|
+
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
19
|
+
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <lib6lowpan/blip-tinyos-includes.h>
|
24
|
+
#include <lib6lowpan/6lowpan.h>
|
25
|
+
#include <lib6lowpan/lib6lowpan.h>
|
26
|
+
#include <lib6lowpan/ip.h>
|
27
|
+
#include <lib6lowpan/in_cksum.h>
|
28
|
+
#include <lib6lowpan/ip_malloc.h>
|
29
|
+
|
30
|
+
#include "blip_printf.h"
|
31
|
+
#include "IPDispatch.h"
|
32
|
+
#include "BlipStatistics.h"
|
33
|
+
#include "table.h"
|
34
|
+
|
35
|
+
/*
|
36
|
+
* Provides IP layer reception to applications on motes.
|
37
|
+
*
|
38
|
+
* @author Stephen Dawson-Haggerty <stevedh@cs.berkeley.edu>
|
39
|
+
*/
|
40
|
+
|
41
|
+
module IPDispatchP {
|
42
|
+
provides {
|
43
|
+
interface SplitControl;
|
44
|
+
// interface for protocols not requiring special hand-holding
|
45
|
+
interface IPLower;
|
46
|
+
|
47
|
+
interface BlipStatistics<ip_statistics_t>;
|
48
|
+
|
49
|
+
}
|
50
|
+
uses {
|
51
|
+
interface Boot;
|
52
|
+
|
53
|
+
|
54
|
+
/* link-layer wiring */
|
55
|
+
interface SplitControl as RadioControl;
|
56
|
+
|
57
|
+
interface Packet as BarePacket;
|
58
|
+
interface Send as Ieee154Send;
|
59
|
+
interface Receive as Ieee154Receive;
|
60
|
+
|
61
|
+
/* context lookup */
|
62
|
+
interface NeighborDiscovery;
|
63
|
+
|
64
|
+
interface ReadLqi;
|
65
|
+
interface PacketLink;
|
66
|
+
interface LowPowerListening;
|
67
|
+
|
68
|
+
/* buffers for outgoing fragments */
|
69
|
+
interface Pool<message_t> as FragPool;
|
70
|
+
interface Pool<struct send_info> as SendInfoPool;
|
71
|
+
interface Pool<struct send_entry> as SendEntryPool;
|
72
|
+
interface Queue<struct send_entry *> as SendQueue;
|
73
|
+
|
74
|
+
/* expire reconstruction */
|
75
|
+
interface Timer<TMilli> as ExpireTimer;
|
76
|
+
|
77
|
+
interface Leds;
|
78
|
+
|
79
|
+
}
|
80
|
+
provides interface Init;
|
81
|
+
} implementation {
|
82
|
+
|
83
|
+
#define HAVE_LOWPAN_EXTERN_MATCH_CONTEXT
|
84
|
+
int lowpan_extern_read_context(struct in6_addr *addr, int context) {
|
85
|
+
return call NeighborDiscovery.getContext(context, addr);
|
86
|
+
}
|
87
|
+
|
88
|
+
int lowpan_extern_match_context(struct in6_addr *addr, uint8_t *ctx_id) {
|
89
|
+
return call NeighborDiscovery.matchContext(addr, ctx_id);
|
90
|
+
}
|
91
|
+
|
92
|
+
// generally including source files like this is a no-no. I'm doing
|
93
|
+
// this in the hope that the optimizer will do a better job when
|
94
|
+
// they're part of a component.
|
95
|
+
#include <lib6lowpan/ieee154_header.c>
|
96
|
+
#include <lib6lowpan/lib6lowpan.c>
|
97
|
+
#include <lib6lowpan/lib6lowpan_4944.c>
|
98
|
+
#include <lib6lowpan/lib6lowpan_frag.c>
|
99
|
+
|
100
|
+
enum {
|
101
|
+
S_RUNNING,
|
102
|
+
S_STOPPED,
|
103
|
+
S_STOPPING,
|
104
|
+
};
|
105
|
+
uint8_t state = S_STOPPED;
|
106
|
+
bool radioBusy;
|
107
|
+
uint8_t current_local_label = 0;
|
108
|
+
ip_statistics_t stats;
|
109
|
+
|
110
|
+
// this in theory could be arbitrarily large; however, it needs to
|
111
|
+
// be large enough to hold all active reconstructions, and any tags
|
112
|
+
// which we are dropping. It's important to keep dropped tags
|
113
|
+
// around for a while, or else there are pathological situations
|
114
|
+
// where you continually allocate buffers for packets which will
|
115
|
+
// never complete.
|
116
|
+
|
117
|
+
////////////////////////////////////////
|
118
|
+
//
|
119
|
+
//
|
120
|
+
|
121
|
+
table_t recon_cache;
|
122
|
+
|
123
|
+
// table of packets we are currently receiving fragments from, that
|
124
|
+
// are destined to us
|
125
|
+
struct lowpan_reconstruct recon_data[N_RECONSTRUCTIONS];
|
126
|
+
|
127
|
+
//
|
128
|
+
//
|
129
|
+
////////////////////////////////////////
|
130
|
+
|
131
|
+
// task void sendTask();
|
132
|
+
|
133
|
+
void reconstruct_clear(void *ent) {
|
134
|
+
struct lowpan_reconstruct *recon = (struct lowpan_reconstruct *)ent;
|
135
|
+
memclr((uint8_t *)&recon->r_meta, sizeof(struct ip6_metadata));
|
136
|
+
recon->r_timeout = T_UNUSED;
|
137
|
+
recon->r_buf = NULL;
|
138
|
+
}
|
139
|
+
|
140
|
+
struct send_info *getSendInfo() {
|
141
|
+
struct send_info *ret = call SendInfoPool.get();
|
142
|
+
if (ret == NULL) return ret;
|
143
|
+
ret->_refcount = 1;
|
144
|
+
ret->upper_data = NULL;
|
145
|
+
ret->failed = FALSE;
|
146
|
+
ret->link_transmissions = 0;
|
147
|
+
ret->link_fragments = 0;
|
148
|
+
ret->link_fragment_attempts = 0;
|
149
|
+
return ret;
|
150
|
+
}
|
151
|
+
#define SENDINFO_INCR(X) ((X)->_refcount)++
|
152
|
+
void SENDINFO_DECR(struct send_info *si) {
|
153
|
+
if (--(si->_refcount) == 0) {
|
154
|
+
call SendInfoPool.put(si);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
command error_t SplitControl.start() {
|
159
|
+
return call RadioControl.start();
|
160
|
+
}
|
161
|
+
|
162
|
+
command error_t SplitControl.stop() {
|
163
|
+
if (!radioBusy) {
|
164
|
+
state = S_STOPPED;
|
165
|
+
return call RadioControl.stop();
|
166
|
+
} else {
|
167
|
+
// if there's a packet in the radio, wait for it to exit before
|
168
|
+
// stopping
|
169
|
+
state = S_STOPPING;
|
170
|
+
return SUCCESS;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
event void RadioControl.startDone(error_t error) {
|
175
|
+
#ifdef LPL_SLEEP_INTERVAL
|
176
|
+
call LowPowerListening.setLocalWakeupInterval(LPL_SLEEP_INTERVAL);
|
177
|
+
#endif
|
178
|
+
|
179
|
+
if (error == SUCCESS) {
|
180
|
+
call Leds.led2Toggle();
|
181
|
+
call ExpireTimer.startPeriodic(FRAG_EXPIRE_TIME);
|
182
|
+
state = S_RUNNING;
|
183
|
+
radioBusy = FALSE;
|
184
|
+
}
|
185
|
+
|
186
|
+
signal SplitControl.startDone(error);
|
187
|
+
}
|
188
|
+
|
189
|
+
event void RadioControl.stopDone(error_t error) {
|
190
|
+
signal SplitControl.stopDone(error);
|
191
|
+
}
|
192
|
+
|
193
|
+
command error_t Init.init() {
|
194
|
+
// ip_malloc_init needs to be in init, not booted, because
|
195
|
+
// context for coap is initialised in init
|
196
|
+
ip_malloc_init();
|
197
|
+
return SUCCESS;
|
198
|
+
}
|
199
|
+
|
200
|
+
event void Boot.booted() {
|
201
|
+
call BlipStatistics.clear();
|
202
|
+
|
203
|
+
/* set up our reconstruction cache */
|
204
|
+
table_init(&recon_cache, recon_data, sizeof(struct lowpan_reconstruct), N_RECONSTRUCTIONS);
|
205
|
+
table_map(&recon_cache, reconstruct_clear);
|
206
|
+
|
207
|
+
call SplitControl.start();
|
208
|
+
}
|
209
|
+
|
210
|
+
/*
|
211
|
+
* Receive-side code.
|
212
|
+
*/
|
213
|
+
void deliver(struct lowpan_reconstruct *recon) {
|
214
|
+
struct ip6_hdr *iph = (struct ip6_hdr *)recon->r_buf;
|
215
|
+
|
216
|
+
// printf("deliver [%i]: ", recon->r_bytes_rcvd);
|
217
|
+
// printf_buf(recon->r_buf, recon->r_bytes_rcvd);
|
218
|
+
|
219
|
+
/* the payload length field is always compressed, have to put it back here */
|
220
|
+
iph->ip6_plen = htons(recon->r_bytes_rcvd - sizeof(struct ip6_hdr));
|
221
|
+
signal IPLower.recv(iph, (void *)(iph + 1), &recon->r_meta);
|
222
|
+
|
223
|
+
// printf("ip_free(%p)\n", recon->r_buf);
|
224
|
+
ip_free(recon->r_buf);
|
225
|
+
recon->r_timeout = T_UNUSED;
|
226
|
+
recon->r_buf = NULL;
|
227
|
+
}
|
228
|
+
|
229
|
+
/*
|
230
|
+
* Bulletproof recovery logic is very important to make sure we
|
231
|
+
* don't get wedged with no free buffers.
|
232
|
+
*
|
233
|
+
* The table is managed as follows:
|
234
|
+
* - unused entries are marked T_UNUSED
|
235
|
+
* - entries which
|
236
|
+
* o have a buffer allocated
|
237
|
+
* o have had a fragment reception before we fired
|
238
|
+
* are marked T_ACTIVE
|
239
|
+
* - entries which have not had a fragment reception during the last timer period
|
240
|
+
* and were active are marked T_ZOMBIE
|
241
|
+
* - zombie receptions are deleted: their buffer is freed and table entry marked unused.
|
242
|
+
* - when a fragment is dropped, it is entered into the table as T_FAILED1.
|
243
|
+
* no buffer is allocated
|
244
|
+
* - when the timer fires, T_FAILED1 entries are aged to T_FAILED2.
|
245
|
+
* - T_FAILED2 entries are deleted. Incomming fragments with tags
|
246
|
+
* that are marked either FAILED1 or FAILED2 are dropped; this
|
247
|
+
* prevents us from allocating a buffer for a packet which we
|
248
|
+
* have already dropped fragments from.
|
249
|
+
*
|
250
|
+
*/
|
251
|
+
void reconstruct_age(void *elt) {
|
252
|
+
struct lowpan_reconstruct *recon = (struct lowpan_reconstruct *)elt;
|
253
|
+
if (recon->r_timeout != T_UNUSED)
|
254
|
+
printf("recon src: 0x%x tag: 0x%x buf: %p recvd: %i/%i\n",
|
255
|
+
recon->r_source_key, recon->r_tag, recon->r_buf,
|
256
|
+
recon->r_bytes_rcvd, recon->r_size);
|
257
|
+
switch (recon->r_timeout) {
|
258
|
+
case T_ACTIVE:
|
259
|
+
recon->r_timeout = T_ZOMBIE; break; // age existing receptions
|
260
|
+
case T_FAILED1:
|
261
|
+
recon->r_timeout = T_FAILED2; break; // age existing receptions
|
262
|
+
case T_ZOMBIE:
|
263
|
+
case T_FAILED2:
|
264
|
+
// deallocate the space for reconstruction
|
265
|
+
printf("timing out buffer: src: %i tag: %i\n", recon->r_source_key, recon->r_tag);
|
266
|
+
if (recon->r_buf != NULL) {
|
267
|
+
printf("ip_free(%p)\n", recon->r_buf);
|
268
|
+
ip_free(recon->r_buf);
|
269
|
+
}
|
270
|
+
recon->r_timeout = T_UNUSED;
|
271
|
+
recon->r_buf = NULL;
|
272
|
+
break;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
void ip_print_heap() {
|
277
|
+
#ifdef PRINTFUART_ENABLED
|
278
|
+
bndrt_t *cur = (bndrt_t *)heap;
|
279
|
+
while (((uint8_t *)cur) - heap < IP_MALLOC_HEAP_SIZE) {
|
280
|
+
printf ("heap region start: %p length: %u used: %u\n",
|
281
|
+
cur, (*cur & IP_MALLOC_LEN), (*cur & IP_MALLOC_INUSE) >> 15);
|
282
|
+
cur = (bndrt_t *)(((uint8_t *)cur) + ((*cur) & IP_MALLOC_LEN));
|
283
|
+
}
|
284
|
+
#endif
|
285
|
+
}
|
286
|
+
|
287
|
+
event void ExpireTimer.fired() {
|
288
|
+
table_map(&recon_cache, reconstruct_age);
|
289
|
+
|
290
|
+
|
291
|
+
printf("Frag pool size: %i\n", call FragPool.size());
|
292
|
+
printf("SendInfo pool size: %i\n", call SendInfoPool.size());
|
293
|
+
printf("SendEntry pool size: %i\n", call SendEntryPool.size());
|
294
|
+
printf("Forward queue length: %i\n", call SendQueue.size());
|
295
|
+
ip_print_heap();
|
296
|
+
printfflush();
|
297
|
+
}
|
298
|
+
|
299
|
+
/*
|
300
|
+
* allocate a structure for recording information about incomming fragments.
|
301
|
+
*/
|
302
|
+
|
303
|
+
struct lowpan_reconstruct *get_reconstruct(uint16_t key, uint16_t tag) {
|
304
|
+
struct lowpan_reconstruct *ret = NULL;
|
305
|
+
int i;
|
306
|
+
|
307
|
+
// printf("get_reconstruct: %x %i\n", key, tag);
|
308
|
+
|
309
|
+
for (i = 0; i < N_RECONSTRUCTIONS; i++) {
|
310
|
+
struct lowpan_reconstruct *recon = (struct lowpan_reconstruct *)&recon_data[i];
|
311
|
+
|
312
|
+
if (recon->r_tag == tag &&
|
313
|
+
recon->r_source_key == key) {
|
314
|
+
|
315
|
+
if (recon->r_timeout > T_UNUSED) {
|
316
|
+
recon->r_timeout = T_ACTIVE;
|
317
|
+
ret = recon;
|
318
|
+
goto done;
|
319
|
+
|
320
|
+
} else if (recon->r_timeout < T_UNUSED) {
|
321
|
+
// if we have already tried and failed to get a buffer, we
|
322
|
+
// need to drop remaining fragments.
|
323
|
+
ret = NULL;
|
324
|
+
goto done;
|
325
|
+
}
|
326
|
+
}
|
327
|
+
if (recon->r_timeout == T_UNUSED)
|
328
|
+
ret = recon;
|
329
|
+
}
|
330
|
+
done:
|
331
|
+
// printf("got%p\n", ret);
|
332
|
+
return ret;
|
333
|
+
}
|
334
|
+
|
335
|
+
event message_t *Ieee154Receive.receive(message_t *msg, void *msg_payload, uint8_t len) {
|
336
|
+
struct packed_lowmsg lowmsg;
|
337
|
+
struct ieee154_frame_addr frame_address;
|
338
|
+
uint8_t *buf = msg_payload;
|
339
|
+
|
340
|
+
// printf(" -- RECEIVE -- len : %i\n", len);
|
341
|
+
|
342
|
+
BLIP_STATS_INCR(stats.rx_total);
|
343
|
+
|
344
|
+
/* unpack the 802.15.4 address fields */
|
345
|
+
buf = unpack_ieee154_hdr(msg_payload, &frame_address);
|
346
|
+
len -= buf - (uint8_t *)msg_payload;
|
347
|
+
|
348
|
+
/* unpack and 6lowpan headers */
|
349
|
+
lowmsg.data = buf;
|
350
|
+
lowmsg.len = len;
|
351
|
+
lowmsg.headers = getHeaderBitmap(&lowmsg);
|
352
|
+
if (lowmsg.headers == LOWMSG_NALP) {
|
353
|
+
goto fail;
|
354
|
+
}
|
355
|
+
|
356
|
+
if (hasFrag1Header(&lowmsg) || hasFragNHeader(&lowmsg)) {
|
357
|
+
// start reassembly
|
358
|
+
int rv;
|
359
|
+
struct lowpan_reconstruct *recon;
|
360
|
+
uint16_t tag, source_key;
|
361
|
+
|
362
|
+
source_key = ieee154_hashaddr(&frame_address.ieee_src);
|
363
|
+
getFragDgramTag(&lowmsg, &tag);
|
364
|
+
recon = get_reconstruct(source_key, tag);
|
365
|
+
if (!recon) {
|
366
|
+
goto fail;
|
367
|
+
}
|
368
|
+
|
369
|
+
/* fill in metadata: on fragmented packets, it applies to the
|
370
|
+
first fragment only */
|
371
|
+
memcpy(&recon->r_meta.sender, &frame_address.ieee_src,
|
372
|
+
sizeof(ieee154_addr_t));
|
373
|
+
recon->r_meta.lqi = call ReadLqi.readLqi(msg);
|
374
|
+
recon->r_meta.rssi = call ReadLqi.readRssi(msg);
|
375
|
+
|
376
|
+
if (hasFrag1Header(&lowmsg)) {
|
377
|
+
if (recon->r_buf != NULL) goto fail;
|
378
|
+
rv = lowpan_recon_start(&frame_address, recon, buf, len);
|
379
|
+
} else {
|
380
|
+
rv = lowpan_recon_add(recon, buf, len);
|
381
|
+
}
|
382
|
+
|
383
|
+
if (rv < 0) {
|
384
|
+
recon->r_timeout = T_FAILED1;
|
385
|
+
goto fail;
|
386
|
+
} else {
|
387
|
+
// printf("start recon buf: %p\n", recon->r_buf);
|
388
|
+
recon->r_timeout = T_ACTIVE;
|
389
|
+
recon->r_source_key = source_key;
|
390
|
+
recon->r_tag = tag;
|
391
|
+
}
|
392
|
+
|
393
|
+
if (recon->r_size == recon->r_bytes_rcvd) {
|
394
|
+
deliver(recon);
|
395
|
+
}
|
396
|
+
|
397
|
+
} else {
|
398
|
+
/* no fragmentation, just deliver it */
|
399
|
+
int rv;
|
400
|
+
struct lowpan_reconstruct recon;
|
401
|
+
|
402
|
+
/* fill in metadata */
|
403
|
+
memcpy(&recon.r_meta.sender, &frame_address.ieee_src,
|
404
|
+
sizeof(ieee154_addr_t));
|
405
|
+
recon.r_meta.lqi = call ReadLqi.readLqi(msg);
|
406
|
+
recon.r_meta.rssi = call ReadLqi.readRssi(msg);
|
407
|
+
|
408
|
+
buf = getLowpanPayload(&lowmsg);
|
409
|
+
if ((rv = lowpan_recon_start(&frame_address, &recon, buf, len)) < 0) {
|
410
|
+
goto fail;
|
411
|
+
}
|
412
|
+
|
413
|
+
if (recon.r_size == recon.r_bytes_rcvd) {
|
414
|
+
deliver(&recon);
|
415
|
+
} else {
|
416
|
+
// printf("ip_free(%p)\n", recon.r_buf);
|
417
|
+
ip_free(recon.r_buf);
|
418
|
+
}
|
419
|
+
}
|
420
|
+
goto done;
|
421
|
+
fail:
|
422
|
+
BLIP_STATS_INCR(stats.rx_drop);
|
423
|
+
done:
|
424
|
+
return msg;
|
425
|
+
}
|
426
|
+
|
427
|
+
|
428
|
+
/*
|
429
|
+
* Send-side functionality
|
430
|
+
*/
|
431
|
+
task void sendTask() {
|
432
|
+
struct send_entry *s_entry;
|
433
|
+
|
434
|
+
// printf("sendTask() - sending\n");
|
435
|
+
|
436
|
+
if (radioBusy || state != S_RUNNING) return;
|
437
|
+
if (call SendQueue.empty()) return;
|
438
|
+
// this does not dequeue
|
439
|
+
s_entry = call SendQueue.head();
|
440
|
+
|
441
|
+
#ifdef LPL_SLEEP_INTERVAL
|
442
|
+
call LowPowerListening.setRemoteWakeupInterval(s_entry->msg,
|
443
|
+
call LowPowerListening.getLocalWakeupInterval());
|
444
|
+
#endif
|
445
|
+
|
446
|
+
if (s_entry->info->failed) {
|
447
|
+
dbg("Drops", "drops: sendTask: dropping failed fragment\n");
|
448
|
+
goto fail;
|
449
|
+
}
|
450
|
+
|
451
|
+
if ((call Ieee154Send.send(s_entry->msg,
|
452
|
+
call BarePacket.payloadLength(s_entry->msg))) != SUCCESS) {
|
453
|
+
dbg("Drops", "drops: sendTask: send failed\n");
|
454
|
+
goto fail;
|
455
|
+
} else {
|
456
|
+
radioBusy = TRUE;
|
457
|
+
}
|
458
|
+
|
459
|
+
return;
|
460
|
+
fail:
|
461
|
+
printf("SEND FAIL\n");
|
462
|
+
post sendTask();
|
463
|
+
BLIP_STATS_INCR(stats.tx_drop);
|
464
|
+
|
465
|
+
// deallocate the memory associated with this request.
|
466
|
+
// other fragments associated with this packet will get dropped.
|
467
|
+
s_entry->info->failed = TRUE;
|
468
|
+
SENDINFO_DECR(s_entry->info);
|
469
|
+
call FragPool.put(s_entry->msg);
|
470
|
+
call SendEntryPool.put(s_entry);
|
471
|
+
call SendQueue.dequeue();
|
472
|
+
}
|
473
|
+
|
474
|
+
|
475
|
+
/*
|
476
|
+
* it will pack the message into the fragment pool and enqueue
|
477
|
+
* those fragments for sending
|
478
|
+
*
|
479
|
+
* it will set
|
480
|
+
* - payload length
|
481
|
+
* - version, traffic class and flow label
|
482
|
+
*
|
483
|
+
* the source and destination IP addresses must be set by higher
|
484
|
+
* layers.
|
485
|
+
*/
|
486
|
+
command error_t IPLower.send(struct ieee154_frame_addr *frame_addr,
|
487
|
+
struct ip6_packet *msg,
|
488
|
+
void *data) {
|
489
|
+
struct lowpan_ctx ctx;
|
490
|
+
struct send_info *s_info;
|
491
|
+
struct send_entry *s_entry;
|
492
|
+
message_t *outgoing;
|
493
|
+
|
494
|
+
int frag_len = 1;
|
495
|
+
error_t rc = SUCCESS;
|
496
|
+
|
497
|
+
if (state != S_RUNNING) {
|
498
|
+
return EOFF;
|
499
|
+
}
|
500
|
+
|
501
|
+
/* set version to 6 in case upper layers forgot */
|
502
|
+
msg->ip6_hdr.ip6_vfc &= ~IPV6_VERSION_MASK;
|
503
|
+
msg->ip6_hdr.ip6_vfc |= IPV6_VERSION;
|
504
|
+
|
505
|
+
ctx.tag = current_local_label++;
|
506
|
+
ctx.offset = 0;
|
507
|
+
|
508
|
+
s_info = getSendInfo();
|
509
|
+
if (s_info == NULL) {
|
510
|
+
rc = ERETRY;
|
511
|
+
goto cleanup_outer;
|
512
|
+
}
|
513
|
+
s_info->upper_data = data;
|
514
|
+
|
515
|
+
while (frag_len > 0) {
|
516
|
+
s_entry = call SendEntryPool.get();
|
517
|
+
outgoing = call FragPool.get();
|
518
|
+
|
519
|
+
if (s_entry == NULL || outgoing == NULL) {
|
520
|
+
if (s_entry != NULL)
|
521
|
+
call SendEntryPool.put(s_entry);
|
522
|
+
if (outgoing != NULL)
|
523
|
+
call FragPool.put(outgoing);
|
524
|
+
// this will cause any fragments we have already enqueued to
|
525
|
+
// be dropped by the send task.
|
526
|
+
s_info->failed = TRUE;
|
527
|
+
printf("drops: IP send: no fragments\n");
|
528
|
+
rc = ERETRY;
|
529
|
+
goto done;
|
530
|
+
}
|
531
|
+
|
532
|
+
call BarePacket.clear(outgoing);
|
533
|
+
frag_len = lowpan_frag_get(call Ieee154Send.getPayload(outgoing, 0),
|
534
|
+
call BarePacket.maxPayloadLength(),
|
535
|
+
msg,
|
536
|
+
frame_addr,
|
537
|
+
&ctx);
|
538
|
+
if (frag_len < 0) {
|
539
|
+
printf(" get frag error: %i\n", frag_len);
|
540
|
+
}
|
541
|
+
|
542
|
+
printf("fragment length: %i offset: %i\n", frag_len, ctx.offset);
|
543
|
+
call BarePacket.setPayloadLength(outgoing, frag_len);
|
544
|
+
|
545
|
+
if (frag_len <= 0) {
|
546
|
+
call FragPool.put(outgoing);
|
547
|
+
call SendEntryPool.put(s_entry);
|
548
|
+
goto done;
|
549
|
+
}
|
550
|
+
|
551
|
+
if (call SendQueue.enqueue(s_entry) != SUCCESS) {
|
552
|
+
BLIP_STATS_INCR(stats.encfail);
|
553
|
+
s_info->failed = TRUE;
|
554
|
+
printf("drops: IP send: enqueue failed\n");
|
555
|
+
goto done;
|
556
|
+
}
|
557
|
+
|
558
|
+
s_info->link_fragments++;
|
559
|
+
s_entry->msg = outgoing;
|
560
|
+
s_entry->info = s_info;
|
561
|
+
|
562
|
+
/* configure the L2 */
|
563
|
+
if (frame_addr->ieee_dst.ieee_mode == IEEE154_ADDR_SHORT &&
|
564
|
+
frame_addr->ieee_dst.i_saddr == IEEE154_BROADCAST_ADDR) {
|
565
|
+
call PacketLink.setRetries(s_entry->msg, 0);
|
566
|
+
} else {
|
567
|
+
call PacketLink.setRetries(s_entry->msg, BLIP_L2_RETRIES);
|
568
|
+
}
|
569
|
+
call PacketLink.setRetryDelay(s_entry->msg, BLIP_L2_DELAY);
|
570
|
+
|
571
|
+
SENDINFO_INCR(s_info);}
|
572
|
+
|
573
|
+
// printf("got %i frags\n", s_info->link_fragments);
|
574
|
+
done:
|
575
|
+
BLIP_STATS_INCR(stats.sent);
|
576
|
+
SENDINFO_DECR(s_info);
|
577
|
+
post sendTask();
|
578
|
+
cleanup_outer:
|
579
|
+
return rc;
|
580
|
+
}
|
581
|
+
|
582
|
+
event void Ieee154Send.sendDone(message_t *msg, error_t error) {
|
583
|
+
struct send_entry *s_entry = call SendQueue.head();
|
584
|
+
|
585
|
+
radioBusy = FALSE;
|
586
|
+
|
587
|
+
// printf("sendDone: %p %i\n", msg, error);
|
588
|
+
|
589
|
+
if (state == S_STOPPING) {
|
590
|
+
call RadioControl.stop();
|
591
|
+
state = S_STOPPED;
|
592
|
+
goto done;
|
593
|
+
}
|
594
|
+
|
595
|
+
s_entry->info->link_transmissions += (call PacketLink.getRetries(msg));
|
596
|
+
s_entry->info->link_fragment_attempts++;
|
597
|
+
|
598
|
+
if (!call PacketLink.wasDelivered(msg)) {
|
599
|
+
printf("sendDone: was not delivered! (%i tries)\n",
|
600
|
+
call PacketLink.getRetries(msg));
|
601
|
+
s_entry->info->failed = TRUE;
|
602
|
+
signal IPLower.sendDone(s_entry->info);
|
603
|
+
/* if (s_entry->info->policy.dest[0] != 0xffff) */
|
604
|
+
/* dbg("Drops", "drops: sendDone: frag was not delivered\n"); */
|
605
|
+
// need to check for broadcast frames
|
606
|
+
// BLIP_STATS_INCR(stats.tx_drop);
|
607
|
+
} else if (s_entry->info->link_fragment_attempts ==
|
608
|
+
s_entry->info->link_fragments) {
|
609
|
+
signal IPLower.sendDone(s_entry->info);
|
610
|
+
}
|
611
|
+
|
612
|
+
done:
|
613
|
+
// kill off any pending fragments
|
614
|
+
SENDINFO_DECR(s_entry->info);
|
615
|
+
call FragPool.put(s_entry->msg);
|
616
|
+
call SendEntryPool.put(s_entry);
|
617
|
+
call SendQueue.dequeue();
|
618
|
+
|
619
|
+
post sendTask();
|
620
|
+
}
|
621
|
+
|
622
|
+
#if 0
|
623
|
+
command struct tlv_hdr *IPExtensions.findTlv(struct ip6_ext *ext, uint8_t tlv_val) {
|
624
|
+
int len = ext->len - sizeof(struct ip6_ext);
|
625
|
+
struct tlv_hdr *tlv = (struct tlv_hdr *)(ext + 1);
|
626
|
+
while (len > 0) {
|
627
|
+
if (tlv->type == tlv_val) return tlv;
|
628
|
+
if (tlv->len == 0) return NULL;
|
629
|
+
tlv = (struct tlv_hdr *)(((uint8_t *)tlv) + tlv->len);
|
630
|
+
len -= tlv->len;
|
631
|
+
}
|
632
|
+
return NULL;
|
633
|
+
}
|
634
|
+
#endif
|
635
|
+
|
636
|
+
|
637
|
+
/*
|
638
|
+
* BlipStatistics interface
|
639
|
+
*/
|
640
|
+
command void BlipStatistics.get(ip_statistics_t *statistics) {
|
641
|
+
#ifdef BLIP_STATS_IP_MEM
|
642
|
+
stats.fragpool = call FragPool.size();
|
643
|
+
stats.sendinfo = call SendInfoPool.size();
|
644
|
+
stats.sendentry= call SendEntryPool.size();
|
645
|
+
stats.sndqueue = call SendQueue.size();
|
646
|
+
stats.heapfree = ip_malloc_freespace();
|
647
|
+
printf("frag: %i sendinfo: %i sendentry: %i sendqueue: %i heap: %i\n",
|
648
|
+
stats.fragpool,
|
649
|
+
stats.sendinfo,
|
650
|
+
stats.sendentry,
|
651
|
+
stats.sndqueue,
|
652
|
+
stats.heapfree);
|
653
|
+
#endif
|
654
|
+
memcpy(statistics, &stats, sizeof(ip_statistics_t));
|
655
|
+
|
656
|
+
}
|
657
|
+
|
658
|
+
command void BlipStatistics.clear() {
|
659
|
+
memclr((uint8_t *)&stats, sizeof(ip_statistics_t));
|
660
|
+
}
|
661
|
+
|
662
|
+
/* default event void IP.recv[uint8_t nxt_hdr](struct ip6_hdr *iph, */
|
663
|
+
/* void *payload, */
|
664
|
+
/* struct ip_metadata *meta) { */
|
665
|
+
/* } */
|
666
|
+
|
667
|
+
/* default event void Multicast.recv[uint8_t scope](struct ip6_hdr *iph, */
|
668
|
+
/* void *payload, */
|
669
|
+
/* struct ip_metadata *meta) { */
|
670
|
+
/* } */
|
671
|
+
}
|