falias.scm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ;;; Guile Emacs Lisp
  2. ;; Copyright (C) 2011, 2017 Free Software Foundation, Inc.
  3. ;;;; This library is free software; you can redistribute it and/or
  4. ;;;; modify it under the terms of the GNU Lesser General Public
  5. ;;;; License as published by the Free Software Foundation; either
  6. ;;;; version 3 of the License, or (at your option) any later version.
  7. ;;;;
  8. ;;;; This library is distributed in the hope that it will be useful,
  9. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. ;;;; Lesser General Public License for more details.
  12. ;;;;
  13. ;;;; You should have received a copy of the GNU Lesser General Public
  14. ;;;; License along with this library; if not, write to the Free Software
  15. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  16. ;;; Code:
  17. (define-module (language elisp falias)
  18. #:export (falias?
  19. make-falias
  20. falias-function
  21. falias-object))
  22. (define <falias-vtable>
  23. (make-struct/no-tail
  24. <applicable-struct-vtable>
  25. (make-struct-layout "pwpw")
  26. (lambda (object port)
  27. (format port "#<falias ~S>" (falias-object object)))))
  28. (set-struct-vtable-name! <falias-vtable> 'falias)
  29. (define (falias? object)
  30. (and (struct? object)
  31. (eq? (struct-vtable object) <falias-vtable>)))
  32. (define (make-falias f object)
  33. (make-struct/no-tail <falias-vtable> f object))
  34. (define (falias-function object)
  35. (struct-ref object 0))
  36. (define (falias-object object)
  37. (struct-ref object 1))