options.lisp 976 B

12345678910111213141516171819202122232425262728
  1. (in-package :hurd-translator)
  2. (defun %get-options-callback (port data data-len)
  3. "Writes translator options to data foreign pointer."
  4. (when (port-exists-p port)
  5. (let* ((opts (options *translator*))
  6. (args0 (when opts (get-translator-options opts)))
  7. (args (cons
  8. (name *translator*) args0))
  9. (len-args (string-list-len args))
  10. (total (sum-list len-args)))
  11. (when (< (mem-ref data-len 'msg-type-number)
  12. total)
  13. (setf (mem-ref data :pointer)
  14. (mmap (null-pointer)
  15. total
  16. '(:prot-read :prot-write)
  17. '(:map-anon)
  18. 0
  19. 0)))
  20. (setf (mem-ref data-len 'msg-type-number) total)
  21. (list-to-foreign-string-zero-separated args
  22. (mem-ref data :pointer)
  23. len-args)
  24. t)))