record-command.scm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Mike Sperber
  3. ; Command-level integration of nongenerative record types.
  4. (define-user-command-syntax 'list-nongenerative-record-types ""
  5. "list the nongenerative record types"
  6. '())
  7. (define-user-command-syntax 'delete-nongenerative-record-type "<uid>"
  8. "delete a nongenerative record type"
  9. '(name))
  10. (define (list-nongenerative-record-types-command)
  11. (for-each (lambda (rtd)
  12. (let ((port (command-output)))
  13. (display (record-type-name rtd) port)
  14. (display " [" port)
  15. (display (record-type-uid rtd) port)
  16. (display "]" port)
  17. (newline port)))
  18. (nongenerative-record-types)))
  19. (define (delete-nongenerative-record-type-command uid)
  20. (if (not (delete-nongenerative-record-type uid))
  21. (let ((port (command-output)))
  22. (display "not found" port)
  23. (newline port))))
  24. (environment-define! (user-command-environment)
  25. 'list-nongenerative-record-types
  26. list-nongenerative-record-types-command)
  27. (environment-define! (user-command-environment)
  28. 'delete-nongenerative-record-type
  29. delete-nongenerative-record-type-command)