PageRenderTime 42ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/test/etags/forth-src/test-forth.fth

http://github.com/davidswelt/aquamacs-emacs
Forth | 53 lines | 38 code | 14 blank | 1 comment | 1 complexity | bd2aa0deb33ed074ed3e46536a8de1f6 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.0, GPL-2.0, AGPL-3.0
  1. \
  2. \ This is a file that tests Forth tags
  3. \
  4. \ You should get:
  5. \ a-forth-word (twice)
  6. \ a-forth-constant!
  7. \ a-forth-value?
  8. \ :a-forth-dictionary-entry
  9. \ #a-defer-word
  10. \ (another-forth-word)
  11. \ (a-forth-constant
  12. \ #some-storage
  13. \ assemby-code-word
  14. \ This is a forth comment
  15. ( Another forth comment )
  16. : a-forth-word ( a b c -- a*b+c ) + * ;
  17. 99 constant a-forth-constant!
  18. 55 value a-forth-value?
  19. create :a-forth-dictionary-entry
  20. 0 c, 9 c, 5 c, 7 c, 999999 ,
  21. defer #a-defer-word
  22. : (another-forth-word) ( -- )
  23. ." Hello world"
  24. ;
  25. ' (another-forth-word) to #a-defer-word
  26. struct
  27. 9 field >field1
  28. 5 field >field2
  29. constant (a-forth-constant
  30. 2000 buffer: #some-storage
  31. code assemby-code-word ( dunno what it does )
  32. g1 g2 mov \ Move from here to there
  33. sc2 h# 13 sc2 sllx \ shift stuff 'round
  34. c;
  35. \ And for the heck of it, redefine a-forth-word.
  36. : a-forth-word ( a b c -- )
  37. a-forth-word dup 200 > abort" Eek. The number is too big"
  38. ." Result is " . cr
  39. ;