pygments.rb-jruby 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/CHANGELOG.md +71 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +17 -0
  6. data/README.md +118 -0
  7. data/Rakefile +66 -0
  8. data/bench.rb +22 -0
  9. data/cache-lexers.rb +8 -0
  10. data/lexers +0 -0
  11. data/lib/pygments.rb +8 -0
  12. data/lib/pygments/lexer.rb +148 -0
  13. data/lib/pygments/mentos.py +351 -0
  14. data/lib/pygments/popen.rb +404 -0
  15. data/lib/pygments/version.rb +3 -0
  16. data/pygments.rb.gemspec +24 -0
  17. data/test/test_data.c +2581 -0
  18. data/test/test_data.py +514 -0
  19. data/test/test_data_generated +2582 -0
  20. data/test/test_pygments.rb +287 -0
  21. data/vendor/custom_lexers/github.py +565 -0
  22. data/vendor/pygments-main/AUTHORS +153 -0
  23. data/vendor/pygments-main/CHANGES +889 -0
  24. data/vendor/pygments-main/LICENSE +25 -0
  25. data/vendor/pygments-main/MANIFEST.in +6 -0
  26. data/vendor/pygments-main/Makefile +59 -0
  27. data/vendor/pygments-main/REVISION +1 -0
  28. data/vendor/pygments-main/TODO +15 -0
  29. data/vendor/pygments-main/docs/generate.py +472 -0
  30. data/vendor/pygments-main/docs/pygmentize.1 +94 -0
  31. data/vendor/pygments-main/docs/src/api.txt +270 -0
  32. data/vendor/pygments-main/docs/src/authors.txt +5 -0
  33. data/vendor/pygments-main/docs/src/changelog.txt +5 -0
  34. data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
  35. data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
  36. data/vendor/pygments-main/docs/src/filters.txt +42 -0
  37. data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
  38. data/vendor/pygments-main/docs/src/formatters.txt +48 -0
  39. data/vendor/pygments-main/docs/src/index.txt +69 -0
  40. data/vendor/pygments-main/docs/src/installation.txt +71 -0
  41. data/vendor/pygments-main/docs/src/integrate.txt +48 -0
  42. data/vendor/pygments-main/docs/src/java.txt +70 -0
  43. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
  44. data/vendor/pygments-main/docs/src/lexers.txt +67 -0
  45. data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
  46. data/vendor/pygments-main/docs/src/plugins.txt +93 -0
  47. data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
  48. data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
  49. data/vendor/pygments-main/docs/src/styles.txt +143 -0
  50. data/vendor/pygments-main/docs/src/tokens.txt +349 -0
  51. data/vendor/pygments-main/docs/src/unicode.txt +49 -0
  52. data/vendor/pygments-main/external/autopygmentize +64 -0
  53. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
  54. data/vendor/pygments-main/external/markdown-processor.py +67 -0
  55. data/vendor/pygments-main/external/moin-parser.py +112 -0
  56. data/vendor/pygments-main/external/pygments.bashcomp +38 -0
  57. data/vendor/pygments-main/external/rst-directive-old.py +77 -0
  58. data/vendor/pygments-main/external/rst-directive.py +83 -0
  59. data/vendor/pygments-main/ez_setup.py +276 -0
  60. data/vendor/pygments-main/pygmentize +7 -0
  61. data/vendor/pygments-main/pygments/__init__.py +91 -0
  62. data/vendor/pygments-main/pygments/cmdline.py +441 -0
  63. data/vendor/pygments-main/pygments/console.py +74 -0
  64. data/vendor/pygments-main/pygments/filter.py +74 -0
  65. data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
  66. data/vendor/pygments-main/pygments/formatter.py +95 -0
  67. data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
  68. data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
  69. data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
  70. data/vendor/pygments-main/pygments/formatters/html.py +821 -0
  71. data/vendor/pygments-main/pygments/formatters/img.py +553 -0
  72. data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
  73. data/vendor/pygments-main/pygments/formatters/other.py +115 -0
  74. data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
  75. data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
  76. data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
  77. data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
  78. data/vendor/pygments-main/pygments/lexer.py +765 -0
  79. data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
  80. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
  81. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
  82. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
  83. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
  84. data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
  85. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
  86. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
  87. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
  88. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
  89. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
  90. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  91. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
  92. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
  93. data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
  94. data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
  96. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  97. data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
  98. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  99. data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
  100. data/vendor/pygments-main/pygments/lexers/github.py +565 -0
  101. data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
  102. data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
  103. data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
  104. data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
  105. data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
  106. data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
  107. data/vendor/pygments-main/pygments/lexers/special.py +100 -0
  108. data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
  109. data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
  110. data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
  111. data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
  112. data/vendor/pygments-main/pygments/modeline.py +40 -0
  113. data/vendor/pygments-main/pygments/plugin.py +74 -0
  114. data/vendor/pygments-main/pygments/scanner.py +104 -0
  115. data/vendor/pygments-main/pygments/style.py +117 -0
  116. data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
  117. data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
  118. data/vendor/pygments-main/pygments/styles/borland.py +51 -0
  119. data/vendor/pygments-main/pygments/styles/bw.py +49 -0
  120. data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
  121. data/vendor/pygments-main/pygments/styles/default.py +73 -0
  122. data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
  123. data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
  124. data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
  125. data/vendor/pygments-main/pygments/styles/manni.py +75 -0
  126. data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
  127. data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
  128. data/vendor/pygments-main/pygments/styles/native.py +65 -0
  129. data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
  130. data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
  131. data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
  132. data/vendor/pygments-main/pygments/styles/tango.py +141 -0
  133. data/vendor/pygments-main/pygments/styles/trac.py +63 -0
  134. data/vendor/pygments-main/pygments/styles/vim.py +63 -0
  135. data/vendor/pygments-main/pygments/styles/vs.py +38 -0
  136. data/vendor/pygments-main/pygments/token.py +195 -0
  137. data/vendor/pygments-main/pygments/unistring.py +140 -0
  138. data/vendor/pygments-main/pygments/util.py +277 -0
  139. data/vendor/pygments-main/scripts/check_sources.py +242 -0
  140. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
  141. data/vendor/pygments-main/scripts/epydoc.css +280 -0
  142. data/vendor/pygments-main/scripts/find_codetags.py +205 -0
  143. data/vendor/pygments-main/scripts/find_error.py +170 -0
  144. data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
  145. data/vendor/pygments-main/scripts/pylintrc +301 -0
  146. data/vendor/pygments-main/scripts/reindent.py +291 -0
  147. data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
  148. data/vendor/pygments-main/setup.cfg +7 -0
  149. data/vendor/pygments-main/setup.py +90 -0
  150. data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
  151. data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
  152. data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
  153. data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
  154. data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
  155. data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
  156. data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
  157. data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
  158. data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
  159. data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
  160. data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
  161. data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
  162. data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
  163. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  164. data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
  165. data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
  166. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  167. data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
  168. data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
  169. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  170. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  171. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  172. data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
  173. data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
  174. data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
  175. data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
  176. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  177. data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
  178. data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
  179. data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
  180. data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
  181. data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
  182. data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
  183. data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
  184. data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
  185. data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
  186. data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
  187. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
  188. data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
  189. data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
  190. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
  191. data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
  192. data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
  193. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
  194. data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
  195. data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
  196. data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
  197. data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
  198. data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
  199. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
  200. data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
  201. data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
  202. data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
  203. data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
  204. data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
  205. data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
  206. data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
  207. data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
  208. data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
  209. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  210. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  211. data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
  212. data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
  213. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  214. data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
  215. data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
  216. data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
  217. data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
  218. data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
  219. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  220. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  221. data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
  222. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  223. data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
  224. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  225. data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
  226. data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
  227. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  228. data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
  229. data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
  230. data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
  231. data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
  232. data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
  233. data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
  234. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  235. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  236. data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
  237. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  238. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  239. data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
  240. data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
  241. data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
  242. data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
  243. data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
  244. data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
  245. data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
  246. data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
  247. data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
  248. data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
  249. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  250. data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
  251. data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
  252. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  253. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
  254. data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
  255. data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
  256. data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
  257. data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
  258. data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
  259. data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
  260. data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
  261. data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
  262. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
  263. data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
  264. data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
  265. data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
  266. data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
  267. data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
  268. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  269. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  270. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  271. data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
  272. data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
  273. data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
  274. data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
  275. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  276. data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
  277. data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
  278. data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
  279. data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
  280. data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
  281. data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
  282. data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
  283. data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
  284. data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
  285. data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
  286. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  287. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  288. data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
  289. data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
  290. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  291. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
  292. data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
  293. data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
  294. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
  295. data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
  296. data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
  297. data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
  298. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  299. data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
  300. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
  301. data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
  302. data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
  303. data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
  304. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
  305. data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
  306. data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
  307. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
  308. data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
  309. data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
  310. data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
  311. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
  312. data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
  313. data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
  314. data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
  315. data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
  316. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
  317. data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
  318. data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
  319. data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
  320. data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
  321. data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
  322. data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
  323. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  324. data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
  325. data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
  326. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  327. data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
  328. data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
  329. data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
  330. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
  331. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
  332. data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
  333. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
  334. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  335. data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
  336. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
  337. data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
  338. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
  339. data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
  340. data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
  341. data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
  342. data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
  343. data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
  344. data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
  345. data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
  346. data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
  347. data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
  348. data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
  349. data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
  350. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  351. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  352. data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
  353. data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
  354. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  355. data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
  356. data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
  357. data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
  358. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  359. data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
  360. data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
  361. data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
  362. data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
  363. data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
  364. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  365. data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
  366. data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
  367. data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
  368. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  369. data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
  370. data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
  371. data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
  372. data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
  373. data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
  374. data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
  375. data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
  376. data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
  377. data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
  378. data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
  379. data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
  380. data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
  381. data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
  382. data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
  383. data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
  384. data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
  385. data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
  386. data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
  387. data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
  388. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  389. data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
  390. data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
  391. data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
  392. data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
  393. data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
  394. data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
  395. data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
  396. data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
  397. data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
  398. data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
  399. data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
  400. data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
  401. data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
  402. data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
  403. data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
  404. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
  405. data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
  406. data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
  407. data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
  408. data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
  409. data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
  410. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
  411. data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
  412. data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
  413. data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
  414. data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
  415. data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
  416. data/vendor/pygments-main/tests/old_run.py +138 -0
  417. data/vendor/pygments-main/tests/run.py +49 -0
  418. data/vendor/pygments-main/tests/support.py +15 -0
  419. data/vendor/pygments-main/tests/support/tags +36 -0
  420. data/vendor/pygments-main/tests/test_basic_api.py +295 -0
  421. data/vendor/pygments-main/tests/test_clexer.py +31 -0
  422. data/vendor/pygments-main/tests/test_cmdline.py +105 -0
  423. data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
  424. data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
  425. data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
  426. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  427. data/vendor/pygments-main/tests/test_perllexer.py +137 -0
  428. data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
  429. data/vendor/pygments-main/tests/test_token.py +46 -0
  430. data/vendor/pygments-main/tests/test_using_api.py +40 -0
  431. data/vendor/pygments-main/tests/test_util.py +135 -0
  432. data/vendor/simplejson/.gitignore +10 -0
  433. data/vendor/simplejson/.travis.yml +5 -0
  434. data/vendor/simplejson/CHANGES.txt +291 -0
  435. data/vendor/simplejson/LICENSE.txt +19 -0
  436. data/vendor/simplejson/MANIFEST.in +5 -0
  437. data/vendor/simplejson/README.rst +19 -0
  438. data/vendor/simplejson/conf.py +179 -0
  439. data/vendor/simplejson/index.rst +628 -0
  440. data/vendor/simplejson/scripts/make_docs.py +18 -0
  441. data/vendor/simplejson/setup.py +104 -0
  442. data/vendor/simplejson/simplejson/__init__.py +510 -0
  443. data/vendor/simplejson/simplejson/_speedups.c +2745 -0
  444. data/vendor/simplejson/simplejson/decoder.py +425 -0
  445. data/vendor/simplejson/simplejson/encoder.py +567 -0
  446. data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
  447. data/vendor/simplejson/simplejson/scanner.py +77 -0
  448. data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
  449. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
  450. data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
  451. data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
  452. data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
  453. data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
  454. data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
  455. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
  456. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
  457. data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
  458. data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
  459. data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
  460. data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
  461. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
  462. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
  463. data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
  464. data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
  465. data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
  466. data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
  467. data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
  468. data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
  469. data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
  470. data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
  471. data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
  472. data/vendor/simplejson/simplejson/tool.py +39 -0
  473. metadata +557 -0
@@ -0,0 +1,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
+ }