PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Lib/chicken/swigclosprefix.scm

#
Lisp | 31 lines | 28 code | 3 blank | 0 comment | 0 complexity | 87804676500ec821b92eb1967476d310 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. (declare (hide swig-initialize))
  2. (define (swig-initialize obj initargs create)
  3. (slot-set! obj 'swig-this
  4. (if (memq 'swig-this initargs)
  5. (cadr initargs)
  6. (let ((ret (apply create initargs)))
  7. (if (instance? ret)
  8. (slot-ref ret 'swig-this)
  9. ret)))))
  10. (define-class <swig-metaclass-$module> (<class>) (void))
  11. (define-method (compute-getter-and-setter (class <swig-metaclass-$module>) slot allocator)
  12. (if (not (memq ':swig-virtual slot))
  13. (call-next-method)
  14. (let ((getter (let search-get ((lst slot))
  15. (if (null? lst)
  16. #f
  17. (if (eq? (car lst) ':swig-get)
  18. (cadr lst)
  19. (search-get (cdr lst))))))
  20. (setter (let search-set ((lst slot))
  21. (if (null? lst)
  22. #f
  23. (if (eq? (car lst) ':swig-set)
  24. (cadr lst)
  25. (search-set (cdr lst)))))))
  26. (values
  27. (lambda (o) (getter (slot-ref o 'swig-this)))
  28. (lambda (o new) (setter (slot-ref o 'swig-this) new) new)))))