PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/chicken/overload/test-overload.scm

#
Lisp | 45 lines | 32 code | 8 blank | 5 comment | 0 complexity | f72bbca964ad0f98730b11749b975b82 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. ;; This file demonstrates the overloading capabilities of SWIG
  2. (load-library 'example "overload.so")
  3. ;; Low level
  4. ;; ---------
  5. (display "
  6. Trying low level code ...
  7. (foo 1)
  8. (foo \"some string\")
  9. (define A-FOO (new-Foo))
  10. (define ANOTHER-FOO (new-Foo A-FOO)) ;; copy constructor
  11. (Foo-bar A-FOO 2)
  12. (Foo-bar ANOTHER-FOO \"another string\" 3)
  13. ")
  14. (primitive:foo 1)
  15. (primitive:foo "some string")
  16. (define A-FOO (slot-ref (primitive:new-Foo) 'swig-this))
  17. (define ANOTHER-FOO (slot-ref (primitive:new-Foo A-FOO) 'swig-this)) ;; copy constructor
  18. (primitive:Foo-bar A-FOO 2)
  19. (primitive:Foo-bar ANOTHER-FOO "another string" 3)
  20. ;; TinyCLOS
  21. ;; --------
  22. (display "
  23. Trying TinyCLOS code ...
  24. (+foo+ 1)
  25. (+foo+ \"some string\")
  26. (define A-FOO (make <Foo>))
  27. (define ANOTHER-FOO (make <Foo> A-FOO)) ;; copy constructor
  28. (-bar- A-FOO 2)
  29. (-bar- ANOTHER-FOO \"another string\" 3)
  30. ")
  31. (foo 1)
  32. (foo "some string")
  33. (define A-FOO (make <Foo>))
  34. (define ANOTHER-FOO (make <Foo> A-FOO)) ;; copy constructor
  35. (bar A-FOO 2)
  36. (bar ANOTHER-FOO "another string" 3)
  37. (exit)