Previous: asciis predicates, Up: asciis [Index]
The following bindings are exported by the library (vicare
language-extensions ascii-chars).  The identifiers whose name is
prefixed with ‘$’ are bound to unsafe operations: they do
not validate the arguments and applying them to invalid
arguments leads to undefined behaviour.
Evaluate to true if fx is a fixnum representing a reserved character in ASCII encoding according to RFC 3986.
Evaluate to true if fx is a fixnum representing an unreserved character in ASCII encoding according to RFC 3986.
Evaluate to true if fx is a fixnum representing a gen-delim
character in ASCII encoding according to RFC 3986.
Evaluate to true if fx is a fixnum representing a sub-delim
character in ASCII encoding according to RFC 3986.
The argument ?chi must be a fixnum representing the octet at index
?i in the bytevector ?bv; ?bv and ?i must be
identifiers.  Return #t if the 3 bytes at offset ?i
represent a percent–encoded sequence and increment ?i to
reference the third octet; otherwise return #f and set ?i to
the offset of the offending octet; if there are not enough octets:
return #f and leave ?i unchanged.
#!vicare
(import (vicare)
  (vicare language-extensions ascii-chars))
(let* ((bv  '#ve(ascii "ciao"))
       (i   0)
       (chi (bytevector-u8-ref bv i))
       (R   ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #f 0
(let* ((bv  '#ve(ascii "c%ABo"))
       (i   1)
       (chi (bytevector-u8-ref bv i))
       (R   ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #t 3
(let* ((bv  '#ve(ascii "c%AB"))
       (i   1)
       (chi (bytevector-u8-ref bv i))
       (R    ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #t 3
(let* ((bv  '#ve(ascii "c%AZ"))
       (i   1)
       (chi (bytevector-u8-ref bv i))
       (R   ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #f 3
(let* ((bv  '#ve(ascii "c%ZA"))
       (i   1)
       (chi (bytevector-u8-ref bv i))
       (R   ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #f 2
(let* ((bv  '#ve(ascii "c%A"))
       (i   1)
       (chi (bytevector-u8-ref bv i))
       (R   ($ascii-uri-pct-encoded? chi bv i)))
  (values R i))
⇒ #f 1
Evaluate to true if fx is a fixnum matching the pchar
component in ASCII encoding, with the exception of the
percent–encoded sequence as defined by RFC 3986.
The argument ?chi must be a fixnum representing the octet at index
?i in the bytevector ?bv; ?bv and ?i must be
identifiers.  Return #t if the octet ?chi or the 3
bytes at offset ?i represent pchar component in ASCII
encoding; if successful increment ?i to reference the last
matching octet; otherwise return #f and set ?i to the offset
of the offending octet; if there are not enough octets: return #f
and leave ?i unchanged.
Previous: asciis predicates, Up: asciis [Index]