-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsrfi-135.scm
147 lines (117 loc) · 4.64 KB
/
srfi-135.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
;;; Copyright (C) William D Clinger (2016).
;;;
;;; Permission is hereby granted, free of charge, to any person
;;; obtaining a copy of this software and associated documentation
;;; files (the "Software"), to deal in the Software without
;;; restriction, including without limitation the rights to use,
;;; copy, modify, merge, publish, distribute, sublicense, and/or
;;; sell copies of the Software, and to permit persons to whom the
;;; Software is furnished to do so, subject to the following
;;; conditions:
;;;
;;; The above copyright notice and this permission notice shall be
;;; included in all copies or substantial portions of the Software.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
;;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
;;; OTHER DEALINGS IN THE SOFTWARE.
(module (srfi 135)
(;; Predicates
text? textual?
textual-null?
textual-every textual-any
;; Constructors
make-text text
text-tabulate
text-unfold text-unfold-right
;; Conversion
textual->text
textual->string textual->vector textual->list
string->text vector->text list->text reverse-list->text
textual->utf8 textual->utf16be
textual->utf16 textual->utf16le
utf8->text utf16be->text
utf16->text utf16le->text
;; Selection
text-length textual-length
text-ref textual-ref
subtext subtextual
textual-copy
textual-take textual-take-right
textual-drop textual-drop-right
textual-pad textual-pad-right
textual-trim textual-trim-right textual-trim-both
;; Replacement
textual-replace
;; Comparison
textual=? textual-ci=?
textual<? textual-ci<?
textual>? textual-ci>?
textual<=? textual-ci<=?
textual>=? textual-ci>=?
;; Prefixes & suffixes
textual-prefix-length textual-suffix-length
textual-prefix? textual-suffix?
;; Searching
textual-index textual-index-right
textual-skip textual-skip-right
textual-contains textual-contains-right
;; Case conversion
textual-upcase textual-downcase
textual-foldcase textual-titlecase
;; Concatenation
textual-append textual-concatenate textual-concatenate-reverse
textual-join
;; Fold & map & friends
textual-fold textual-fold-right
textual-map textual-for-each
textual-map-index textual-for-each-index
textual-count
textual-filter textual-remove
textual-reverse
;; Replication & splitting
textual-replicate textual-split
)
;; Don't import non-Unicode-aware base procedures.
(import (except (scheme) string-length string-ref string-set!
make-string string substring string->list
list->string string-fill! write-char
read-char display vector->list char<=?
)
(only (r7rs) make-bytevector bytevector? bytevector-u8-set!
bytevector-length bytevector-u8-ref utf8->string
string->utf8 make-list vector->list
char<=?
write-bytevector
)
(chicken base)
(chicken condition)
(except (chicken io) write-string)
(chicken type)
(only (srfi 1) last-pair take unfold every)
(only (srfi 141) euclidean-remainder)
(typed-records)
(utf8)
(only (utf8-srfi-13) string-upcase string-downcase
string-titlecase string-copy!
substring/shared
)
(only (utf8-case-map) char-downcase-single)
(srfi 135 kernel8))
(define-type bytevector u8vector)
(define-type text (struct text-rtd))
(define-type textual (or text string))
;; CHICKEN: We need a Unicode-aware foldcase, so this can't be
;; imported from the r7rs egg.
(define (string-foldcase s) (string-downcase s))
(define (char-foldcase c) (char-downcase-single c))
(include "util.scm")
(include "exceptions.scm")
(include "135.body.scm")
)
;;; eof