[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
13/21: gurses: xchar->char: New procedure.
From: |
John Darrington |
Subject: |
13/21: gurses: xchar->char: New procedure. |
Date: |
Sun, 29 Jan 2017 07:35:02 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit e7a07e59fb36d48e9615c8e247f72910a3a340fa
Author: John Darrington <address@hidden>
Date: Fri Jan 27 08:47:36 2017 +0100
gurses: xchar->char: New procedure.
* gurses/stexi.scm (xchar->char): New procedure.
---
gurses/stexi.scm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gurses/stexi.scm b/gurses/stexi.scm
index b49ff4d..2f04e7e 100644
--- a/gurses/stexi.scm
+++ b/gurses/stexi.scm
@@ -101,6 +101,10 @@ described by the stexi STXI"
(loop (cdr in)
(parse-fragment (car in) acc normal))))))))
+
+(define (xchar->char ch)
+ (car (xchar-chars ch)))
+
(define (offset-to-end-of-word ccs)
"Return the number of xchars until the end of the current word."
@@ -109,14 +113,14 @@ described by the stexi STXI"
cs
('() dist)
(((? xchar? first) . rest)
- (if (char-set-contains? char-set:blank (car (xchar-chars first)))
+ (if (char-set-contains? char-set:blank (xchar->char first))
dist
(offset-to-end-of-word' rest (1+ dist))))))
(offset-to-end-of-word' ccs 0))
(define (remove-leading-whitespace cs)
- (if (char-set-contains? char-set:blank (car (xchar-chars (car cs))))
+ (if (char-set-contains? char-set:blank (xchar->char (car cs)))
(cdr cs)
cs))
@@ -160,7 +164,7 @@ string of length LEN"
(if (null? in)
n
(let ((white (char-set-contains? char-set:blank
- (car (xchar-chars (car in))))))
+ (xchar->char (car in)))))
(loop (cdr in) (1+ x) (if (and prev-white (not white))
(1+ n)
n) white)))))
@@ -179,7 +183,7 @@ string of length LEN"
"You asked to pad to ~a but the string is already ~a
characters long."
len (length str))))
- (if (eqv? (car (xchar-chars (last str))) #\newline)
+ (if (eqv? (xchar->char (last str)) #\newline)
str ; Don't justify the last line of a paragraph
(let loop ((in str)
(out '())
@@ -189,7 +193,7 @@ string of length LEN"
(if (null? in)
(reverse out)
(let* ((white (char-set-contains? char-set:blank
- (car (xchar-chars (car
in)))))
+ (xchar->char (car in))))
(end-of-word (and white (not prev-white)))
(words-processed (if end-of-word (1+ words) words))
(spaces-inserted (if end-of-word
- 04/21: installer: Change livery., (continued)
- 04/21: installer: Change livery., John Darrington, 2017/01/29
- 08/21: installer: Prepare for new wireless network features., John Darrington, 2017/01/29
- 05/21: installer: Tolerate an undefined system role in config generation., John Darrington, 2017/01/29
- 09/21: installer: Clear the mount point field for swap file systems., John Darrington, 2017/01/29
- 03/21: installer: Add new procedure to check file system specifications., John Darrington, 2017/01/29
- 01/21: installer: Delete unused procedure "justify"., John Darrington, 2017/01/29
- 20/21: gurses: Add new procedure "word-endings"., John Darrington, 2017/01/29
- 14/21: gurses: Add predicate to test if a complex char is blank., John Darrington, 2017/01/29
- 12/21: gurses: Avoid one usage of car and cdr., John Darrington, 2017/01/29
- 15/21: gurses: Avoid one more use of car and cdr., John Darrington, 2017/01/29
- 13/21: gurses: xchar->char: New procedure.,
John Darrington <=
- 19/21: installer: Support WEP encrypted wireless., John Darrington, 2017/01/29
- 16/21: gurses: Avoid yet another use of car and cdr., John Darrington, 2017/01/29
- 11/21: installer: Fix the key map option., John Darrington, 2017/01/29
- 18/21: gurses: In paragraph-format avoid use of car and cdr., John Darrington, 2017/01/29
- 06/21: installer: Use a "hard" method of rebooting. Do not rely on shepherd., John Darrington, 2017/01/29
- 10/21: installer: Allow file system specifications to be removed., John Darrington, 2017/01/29
- 17/21: gurses: Use match instead of car/cdr in line-split., John Darrington, 2017/01/29
- 21/21: gurses: Reimplement pad-complex-string., John Darrington, 2017/01/29