PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/www/demo/dumpImage.rx

https://github.com/crcx/retro-language
Forth | 50 lines | 49 code | 1 blank | 0 comment | 0 complexity | 3a24e00671ed84e36db48f9ff036f8af MD5 | raw file
  1. needs array'
  2. needs assertion'
  3. needs bad'
  4. needs bstrings'
  5. needs canvas'
  6. needs char'
  7. needs combinators'
  8. needs decorator'
  9. needs dissect'
  10. needs enum'
  11. needs eval'
  12. needs forth'
  13. needs hash'
  14. needs infix'
  15. needs linkedList'
  16. needs locals'
  17. needs math'
  18. needs stack'
  19. needs struct'
  20. needs values'
  21. {{
  22. create EOL 10 , 0 ,
  23. variable fid
  24. : w/l ( $- )
  25. dup getLength [ @+ @fid ^files'write drop ] times drop ;
  26. : \n ( - ) EOL w/l ;
  27. : cell ( a-a )
  28. dup @ toString w/l ";" w/l ;
  29. : header ( - )
  30. "function loadImage()" w/l \n
  31. "{" w/l \n
  32. "image = '" w/l ;
  33. : footer ( - )
  34. "'.split(';').map(function(x){return parseInt(x)});" w/l \n
  35. "ip = 0;" w/l \n
  36. "}" w/l \n ;
  37. : body ( - ) 0 here [ cell 1+ ] times drop ;
  38. [ ( - )
  39. "retroImage.js" ^files':W ^files'open !fid
  40. header body footer
  41. @fid ^files'close drop ]
  42. }}
  43. hide files'
  44. hide include
  45. hide :include
  46. hide needs
  47. hide getEnv
  48. : needs ( "- ) ' drop ;
  49. do bye