c-primop.scm 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ;;; Ported from Scheme 48 1.9. See file COPYING for notices and license.
  2. ;;;
  3. ;;; Port Author: Andrew Whatson
  4. ;;;
  5. ;;; Original Authors: Richard Kelsey
  6. ;;;
  7. ;;; scheme48-1.9.2/ps-compiler/prescheme/primop/c-primop.scm
  8. ;;;
  9. ;;; Code generation for primops.
  10. (define-module (ps-compiler prescheme primop c-primop)
  11. #:use-module (srfi srfi-9)
  12. #:use-module (ps-compiler node primop)
  13. #:use-module (ps-compiler prescheme primop primop)
  14. #:export (simple-c-primop?
  15. primop-generate-c
  16. define-c-generator))
  17. (define-record-type :c-primop
  18. (make-c-primop simple? generate)
  19. c-primop?
  20. (simple? c-primop-simple?)
  21. (generate c-primop-generate))
  22. (define (simple-c-primop? primop)
  23. (c-primop-simple? (primop-code-data primop)))
  24. (define (primop-generate-c primop call port indent)
  25. ((c-primop-generate (primop-code-data primop))
  26. call port indent))
  27. (define-syntax define-c-generator
  28. (syntax-rules ()
  29. ((_ id simple? generate)
  30. (set-primop-code-data!
  31. (get-prescheme-primop 'id)
  32. (make-c-primop simple? generate)))))