diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-07-21 14:32:24 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-07-21 17:03:24 +0200 |
commit | 0a94dc63964c88903079c0a040162439fe07a306 (patch) | |
tree | a2a3fa0ddd2fcfe7a7f5544f70128f3616c26ad3 | |
parent | 75a4d86f50e1682b96c51eb46a6aba24afc25d03 (diff) | |
download | guix-0a94dc63964c88903079c0a040162439fe07a306.tar guix-0a94dc63964c88903079c0a040162439fe07a306.tar.gz |
base32: Export the base32 charsets.
* guix/base32.scm (%nix-base32-charset, %rfc4648-base32-charset): New
variables.
-rw-r--r-- | guix/base32.scm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/base32.scm b/guix/base32.scm index 7b2e2a6712..49f191ba26 100644 --- a/guix/base32.scm +++ b/guix/base32.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2015, 2017 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +28,8 @@ bytevector->nix-base32-string base32-string->bytevector nix-base32-string->bytevector + %nix-base32-charset + %rfc4648-base32-charset &invalid-base32-character invalid-base32-character? invalid-base32-character-value @@ -152,11 +154,17 @@ the previous application or INIT." #\a #\b #\c #\d #\f #\g #\h #\i #\j #\k #\l #\m #\n #\p #\q #\r #\s #\v #\w #\x #\y #\z)) +(define %nix-base32-charset + (list->char-set (vector->list %nix-base32-chars))) + (define %rfc4648-base32-chars #(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\2 #\3 #\4 #\5 #\6 #\7)) +(define %rfc4648-base32-charset + (list->char-set (vector->list %rfc4648-base32-chars))) + (define bytevector->base32-string (make-bytevector->base32-string bytevector-quintet-fold %rfc4648-base32-chars)) |