1 ;;;; srfi-13.scm --- SRFI-13 procedures for Guile
3 ;;;; Copyright (C) 2001 Free Software Foundation, Inc.
5 ;;;; This program is free software; you can redistribute it and/or
6 ;;;; modify it under the terms of the GNU General Public License as
7 ;;;; published by the Free Software Foundation; either version 2, or
8 ;;;; (at your option) any later version.
10 ;;;; This program is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;;; General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with this software; see the file COPYING. If not, write to
17 ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 ;;;; Boston, MA 02111-1307 USA
20 ;;;; As a special exception, the Free Software Foundation gives permission
21 ;;;; for additional uses of the text contained in its release of GUILE.
23 ;;;; The exception is that, if you link the GUILE library with other files
24 ;;;; to produce an executable, this does not by itself cause the
25 ;;;; resulting executable to be covered by the GNU General Public License.
26 ;;;; Your use of that executable is in no way restricted on account of
27 ;;;; linking the GUILE library code into it.
29 ;;;; This exception does not however invalidate any other reasons why
30 ;;;; the executable file might be covered by the GNU General Public License.
32 ;;;; This exception applies only to the code released by the
33 ;;;; Free Software Foundation under the name GUILE. If you copy
34 ;;;; code from other Free Software Foundation releases into a copy of
35 ;;;; GUILE, as the General Public License permits, the exception does
36 ;;;; not apply to the code that you add in this way. To avoid misleading
37 ;;;; anyone as to the status of such modified files, you must delete
38 ;;;; this exception notice from them.
40 ;;;; If you write modifications of your own for GUILE, it is your choice
41 ;;;; whether to permit this exception to apply to your modifications.
42 ;;;; If you do not wish that, delete this exception notice.
44 (define-module (srfi srfi-13))
47 ;; Prevent `export' from re-exporting core bindings. This behaviour
48 ;; of `export' is deprecated and will disappear in one of the next
50 (define string->list #f)
51 (define string-copy #f)
52 (define string-fill! #f)
53 (define string-index #f)
54 (define string-upcase #f)
55 (define string-upcase! #f)
56 (define string-downcase #f)
57 (define string-downcase! #f))
61 ;; string? string-null? <= in the core
62 string-any string-every
65 ;; make-string string <= in the core
68 ;;; List/string conversion
70 ;; list->string <= in the core
75 ;; string-length string-ref <= in the core
79 string-take string-take-right
80 string-drop string-drop-right
81 string-pad string-pad-right
82 string-trim string-trim-right
86 ;; string-set! <= in the core
90 string-compare string-compare-ci
94 string-ci= string-ci<>
96 string-ci<= string-ci>=
97 string-hash string-hash-ci
101 string-prefix-length-ci
103 string-suffix-length-ci
110 string-index string-index-right
111 string-skip string-skip-right
113 string-contains string-contains-ci
115 ;;; Alphabetic case mapping
117 string-upcase string-upcase!
118 string-downcase string-downcase!
119 string-titlecase string-titlecase!
122 string-reverse string-reverse!
123 ;; string-append <= in the core
126 string-concatenate-reverse
127 string-concatenate/shared
128 string-concatenate-reverse/shared
131 string-map string-map!
139 xsubstring string-xcopy!
145 ;;; Filtering/Deleting
150 (cond-expand-provide (current-module) '(srfi-13))
152 (load-extension "libguile-srfi-srfi-13-14" "scm_init_srfi_13")
156 (let ((bound (if (pair? rest)
160 (start (if (and (pair? rest) (pair? (cdr rest)))
163 (end (if (and (pair? rest) (pair? (cdr rest)) (pair? (cddr rest)))
166 (hash (substring/shared s start end) bound))))
168 (define string-hash-ci
170 (let ((bound (if (pair? rest)
174 (start (if (and (pair? rest) (pair? (cdr rest)))
177 (end (if (and (pair? rest) (pair? (cdr rest)) (pair? (cddr rest)))
180 (hash (string-upcase (substring/shared s start end)) bound))))