Next: , Previous: , Up: syntaxes   [Index]


1.7.4 Converting common arguments

The following bindings are exported by the library (vicare language-extensions syntaxes).

Macro: with-pathnames ((?pathname.bv ?pathname) ...) . ?body

Used to preprocess function arguments which must be bytevectors or strings representing pathnames; the strings are converted to bytevectors. This macro assumes that the arguments have already been validated. Expand to:

(let ((?pathname.bv (let ((pathname ?pathname))
                      (if (bytevector? pathname)
                          pathname
                        ((string->filename-func) pathname))))
      ...)
  . ?body)
Macro: with-bytevectors ((?value.bv ?value) ...) . ?body

Used to preprocess function arguments which must be bytevectors or strings; the strings are converted to bytevectors. This macro assumes that the arguments have already been validated. Expand to:

(let ((?value.bv (let ((V ?value))
                   (if (bytevector? V)
                       V
                     (string->latin1 V))))
      ...)
  . ?body)
Macro: with-bytevectors/or-false ((?value.bv ?value) ...) . ?body

Used to preprocess function arguments which must be bytevectors, strings or false; the strings are converted to bytevectors. This macro assumes that the arguments have already been validated. Expand to:

(let ((?value.bv (let ((V ?value))
                   (cond ((bytevector? V)
                          V)
                         ((string? V)
                          (string->latin1 V))
                         (else V))))
      ...)
  . ?body)