mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* srfi-13.scm, srfi-14.scm: Simply re-export the relevant
bindings. * srfi-13.h, srfi-13.c, srfi-14.h, srfi-14.c: Removed all real content except for the init functions.
This commit is contained in:
parent
7aa29a87f9
commit
0081b349c8
6 changed files with 72 additions and 4719 deletions
3077
srfi/srfi-13.c
3077
srfi/srfi-13.c
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,7 @@
|
|||
#ifndef SCM_SRFI_13_H
|
||||
#define SCM_SRFI_13_H
|
||||
/* srfi-13.c --- SRFI-13 procedures for Guile
|
||||
|
||||
/* SRFI-13 procedures for Guile
|
||||
*
|
||||
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
|
@ -20,6 +21,10 @@
|
|||
*/
|
||||
|
||||
|
||||
/* All SRFI-13 procedures are in in the core now. */
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
/* SCM_SRFI1314_API is a macro prepended to all function and data definitions
|
||||
which should be exported or imported in the resulting dynamic link
|
||||
library in the Win32 port. */
|
||||
|
@ -35,80 +40,17 @@
|
|||
SCM_SRFI1314_API void scm_init_srfi_13 (void);
|
||||
SCM_SRFI1314_API void scm_init_srfi_13_14 (void);
|
||||
|
||||
SCM_SRFI1314_API SCM scm_string_any (SCM pred, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_every (SCM pred, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_tabulate (SCM proc, SCM len);
|
||||
SCM_SRFI1314_API SCM scm_string_to_listS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_reverse_list_to_string (SCM chrs);
|
||||
SCM_SRFI1314_API SCM scm_string_join (SCM ls, SCM delimiter, SCM grammar);
|
||||
SCM_SRFI1314_API SCM scm_string_copyS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_substring_sharedS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_copy_x (SCM target, SCM tstart, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_take (SCM s, SCM n);
|
||||
SCM_SRFI1314_API SCM scm_string_drop (SCM s, SCM n);
|
||||
SCM_SRFI1314_API SCM scm_string_take_right (SCM s, SCM n);
|
||||
SCM_SRFI1314_API SCM scm_string_drop_right (SCM s, SCM n);
|
||||
SCM_SRFI1314_API SCM scm_string_pad (SCM s, SCM len, SCM chr, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_pad_right (SCM s, SCM len, SCM chr, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_trim (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_trim_right (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_trim_both (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_fill_xS (SCM str, SCM chr, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_compare (SCM s1, SCM s2, SCM proc_lt, SCM proc_eq, SCM proc_gt, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_compare_ci (SCM s1, SCM s2, SCM proc_lt, SCM proc_eq, SCM proc_gt, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_eq (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_neq (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_lt (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_gt (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_le (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ge (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_eq (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_neq (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_lt (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_gt (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_le (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_ci_ge (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_prefix_length (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_prefix_length_ci (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_suffix_length (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_suffix_length_ci (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_prefix_p (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_prefix_ci_p (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_suffix_p (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_suffix_ci_p (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_indexS (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_index_right (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_skip (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_skip_right (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_count (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_contains (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_contains_ci (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_upcase_xS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_upcaseS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_downcase_xS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_downcaseS (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_titlecase_x (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_titlecase (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_reverse (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_reverse_x (SCM str, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_append_shared (SCM ls);
|
||||
SCM_SRFI1314_API SCM scm_string_concatenate (SCM ls);
|
||||
SCM_SRFI1314_API SCM scm_string_concatenate_shared (SCM ls);
|
||||
SCM_SRFI1314_API SCM scm_string_concatenate_reverse (SCM ls, SCM final_string, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_concatenate_reverse_shared (SCM ls, SCM final_string, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_map (SCM proc, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_map_x (SCM proc, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_fold (SCM kons, SCM knil, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_fold_right (SCM kons, SCM knil, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_unfold (SCM p, SCM f, SCM g, SCM seed, SCM base, SCM make_final);
|
||||
SCM_SRFI1314_API SCM scm_string_unfold_right (SCM p, SCM f, SCM g, SCM seed, SCM base, SCM make_final);
|
||||
SCM_SRFI1314_API SCM scm_string_for_each (SCM proc, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_for_each_index (SCM proc, SCM s, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_xsubstring (SCM s, SCM from, SCM to, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_xcopy_x (SCM target, SCM tstart, SCM s, SCM sfrom, SCM sto, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_replace (SCM s1, SCM s2, SCM start1, SCM end1, SCM start2, SCM end2);
|
||||
SCM_SRFI1314_API SCM scm_string_tokenize (SCM s, SCM token_char, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_filter (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
SCM_SRFI1314_API SCM scm_string_delete (SCM s, SCM char_pred, SCM start, SCM end);
|
||||
/* The following functions have new names in the core.
|
||||
*/
|
||||
|
||||
#define scm_string_to_listS scm_substring_to_list
|
||||
#define scm_string_copyS scm_substring_copy
|
||||
#define scm_substring_sharedS scm_substring_shared
|
||||
#define scm_string_fill_xS scm_substring_fill_x
|
||||
#define scm_string_indexS scm_string_index
|
||||
#define scm_string_upcase_xS scm_substring_upcase_x
|
||||
#define scm_string_upcaseS scm_substring_upcase
|
||||
#define scm_string_downcase_xS scm_substring_downcase_x
|
||||
#define scm_string_downcaseS scm_substring_downcase
|
||||
|
||||
#endif /* SCM_SRFI_13_H */
|
||||
|
|
|
@ -19,28 +19,35 @@
|
|||
;;; Commentary:
|
||||
|
||||
;; This module is fully documented in the Guile Reference Manual.
|
||||
;;
|
||||
;; All procedures are in the core and are simply reexported here.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(define-module (srfi srfi-13)
|
||||
:export (
|
||||
(define-module (srfi srfi-13))
|
||||
|
||||
(re-export
|
||||
;;; Predicates
|
||||
;; string? string-null? <= in the core
|
||||
string-any string-every
|
||||
string?
|
||||
string-null?
|
||||
string-any
|
||||
string-every
|
||||
|
||||
;;; Constructors
|
||||
;; make-string string <= in the core
|
||||
make-string
|
||||
string
|
||||
string-tabulate
|
||||
|
||||
;;; List/string conversion
|
||||
;; string->list extended
|
||||
;; list->string <= in the core
|
||||
string->list
|
||||
list->string
|
||||
reverse-list->string
|
||||
string-join
|
||||
|
||||
;;; Selection
|
||||
;; string-length string-ref <= in the core
|
||||
;; string-copy extended
|
||||
string-length
|
||||
string-ref
|
||||
string-copy
|
||||
substring/shared
|
||||
string-copy!
|
||||
string-take string-take-right
|
||||
|
@ -50,11 +57,12 @@
|
|||
string-trim-both
|
||||
|
||||
;;; Modification
|
||||
;; string-set! <= in the core
|
||||
;; string-fill! extended
|
||||
string-set!
|
||||
string-fill!
|
||||
|
||||
;;; Comparison
|
||||
string-compare string-compare-ci
|
||||
string-compare
|
||||
string-compare-ci
|
||||
string= string<>
|
||||
string< string>
|
||||
string<= string>=
|
||||
|
@ -74,21 +82,24 @@
|
|||
string-suffix-ci?
|
||||
|
||||
;;; Searching
|
||||
;; string-index extended
|
||||
string-index
|
||||
string-index-right
|
||||
string-skip string-skip-right
|
||||
string-count
|
||||
string-contains string-contains-ci
|
||||
|
||||
;;; Alphabetic case mapping
|
||||
|
||||
;; string-upcase string-upcase! extended
|
||||
;; string-downcase string-downcase! extended
|
||||
string-titlecase string-titlecase!
|
||||
string-upcase
|
||||
string-upcase!
|
||||
string-downcase
|
||||
string-downcase!
|
||||
string-titlecase
|
||||
string-titlecase!
|
||||
|
||||
;;; Reverse/Append
|
||||
string-reverse string-reverse!
|
||||
;; string-append <= in the core
|
||||
string-reverse
|
||||
string-reverse!
|
||||
string-append
|
||||
string-append/shared
|
||||
string-concatenate
|
||||
string-concatenate-reverse
|
||||
|
@ -105,7 +116,8 @@
|
|||
string-for-each-index
|
||||
|
||||
;;; Replicate/Rotate
|
||||
xsubstring string-xcopy!
|
||||
xsubstring
|
||||
string-xcopy!
|
||||
|
||||
;;; Miscellaneous
|
||||
string-replace
|
||||
|
@ -113,43 +125,8 @@
|
|||
|
||||
;;; Filtering/Deleting
|
||||
string-filter
|
||||
string-delete
|
||||
)
|
||||
:replace (string->list string-copy string-fill!
|
||||
string-upcase! string-upcase string-downcase! string-downcase
|
||||
string-index substring/shared)
|
||||
)
|
||||
string-delete)
|
||||
|
||||
(cond-expand-provide (current-module) '(srfi-13))
|
||||
|
||||
(load-extension "libguile-srfi-srfi-13-14" "scm_init_srfi_13")
|
||||
|
||||
(define string-hash
|
||||
(lambda (s . rest)
|
||||
(let ((bound (if (pair? rest)
|
||||
(or (car rest)
|
||||
871)
|
||||
871))
|
||||
(start (if (and (pair? rest) (pair? (cdr rest)))
|
||||
(cadr rest)
|
||||
0))
|
||||
(end (if (and (pair? rest) (pair? (cdr rest)) (pair? (cddr rest)))
|
||||
(caddr rest)
|
||||
(string-length s))))
|
||||
(hash (substring/shared s start end) bound))))
|
||||
|
||||
(define string-hash-ci
|
||||
(lambda (s . rest)
|
||||
(let ((bound (if (pair? rest)
|
||||
(or (car rest)
|
||||
871)
|
||||
871))
|
||||
(start (if (and (pair? rest) (pair? (cdr rest)))
|
||||
(cadr rest)
|
||||
0))
|
||||
(end (if (and (pair? rest) (pair? (cdr rest)) (pair? (cddr rest)))
|
||||
(caddr rest)
|
||||
(string-length s))))
|
||||
(hash (string-upcase (substring/shared s start end)) bound))))
|
||||
|
||||
;;; srfi-13.scm ends here
|
||||
|
|
1404
srfi/srfi-14.c
1404
srfi/srfi-14.c
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
#define SCM_SRFI_14_H
|
||||
/* srfi-14.c --- SRFI-14 procedures for Guile
|
||||
*
|
||||
* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -32,71 +32,7 @@
|
|||
# define SCM_SRFI1314_API extern
|
||||
#endif
|
||||
|
||||
#define SCM_CHARSET_SIZE 256
|
||||
|
||||
/* We expect 8-bit bytes here. Should be no problem in the year
|
||||
2001. */
|
||||
#ifndef SCM_BITS_PER_LONG
|
||||
# define SCM_BITS_PER_LONG (sizeof (long) * 8)
|
||||
#endif
|
||||
|
||||
#define SCM_CHARSET_GET(cs, idx) (((long *) SCM_SMOB_DATA (cs))\
|
||||
[((unsigned char) (idx)) / SCM_BITS_PER_LONG] &\
|
||||
(1L << (((unsigned char) (idx)) % SCM_BITS_PER_LONG)))
|
||||
|
||||
#define SCM_CHARSETP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_charset))
|
||||
|
||||
/* Smob type code for character sets. */
|
||||
SCM_SRFI1314_API int scm_tc16_charset;
|
||||
|
||||
SCM_SRFI1314_API void scm_c_init_srfi_14 (void);
|
||||
SCM_SRFI1314_API void scm_init_srfi_14 (void);
|
||||
|
||||
SCM_SRFI1314_API SCM scm_char_set_p (SCM obj);
|
||||
SCM_SRFI1314_API SCM scm_char_set_eq (SCM char_sets);
|
||||
SCM_SRFI1314_API SCM scm_char_set_leq (SCM char_sets);
|
||||
SCM_SRFI1314_API SCM scm_char_set_hash (SCM cs, SCM bound);
|
||||
SCM_SRFI1314_API SCM scm_char_set_cursor (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_ref (SCM cs, SCM cursor);
|
||||
SCM_SRFI1314_API SCM scm_char_set_cursor_next (SCM cs, SCM cursor);
|
||||
SCM_SRFI1314_API SCM scm_end_of_char_set_p (SCM cursor);
|
||||
SCM_SRFI1314_API SCM scm_char_set_fold (SCM kons, SCM knil, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_unfold (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_unfold_x (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_for_each (SCM proc, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_map (SCM proc, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_copy (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set (SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_list_to_char_set (SCM list, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_list_to_char_set_x (SCM list, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_string_to_char_set (SCM str, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_string_to_char_set_x (SCM str, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_filter (SCM pred, SCM cs, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_filter_x (SCM pred, SCM cs, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_ucs_range_to_char_set (SCM lower, SCM upper, SCM error, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_ucs_range_to_char_set_x (SCM lower, SCM upper, SCM error, SCM base_cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_size (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_count (SCM pred, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_to_list (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_to_string (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_contains_p (SCM cs, SCM ch);
|
||||
SCM_SRFI1314_API SCM scm_char_set_every (SCM pred, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_any (SCM pred, SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_adjoin (SCM cs, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_delete (SCM cs, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_adjoin_x (SCM cs, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_delete_x (SCM cs, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_complement (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_union (SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_intersection (SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_difference (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_xor (SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_diff_plus_intersection (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_complement_x (SCM cs);
|
||||
SCM_SRFI1314_API SCM scm_char_set_union_x (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_intersection_x (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_difference_x (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_xor_x (SCM cs1, SCM rest);
|
||||
SCM_SRFI1314_API SCM scm_char_set_diff_plus_intersection_x (SCM cs1, SCM cs2, SCM rest);
|
||||
|
||||
#endif /* SCM_SRFI_14_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; srfi-14.scm --- Character-set Library
|
||||
|
||||
;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; This library is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,8 +22,9 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(define-module (srfi srfi-14)
|
||||
:export (
|
||||
(define-module (srfi srfi-14))
|
||||
|
||||
(re-export
|
||||
;;; General procedures
|
||||
char-set?
|
||||
char-set=
|
||||
|
@ -91,60 +92,8 @@
|
|||
char-set:blank
|
||||
char-set:ascii
|
||||
char-set:empty
|
||||
char-set:full
|
||||
))
|
||||
char-set:full)
|
||||
|
||||
(cond-expand-provide (current-module) '(srfi-14))
|
||||
|
||||
(load-extension "libguile-srfi-srfi-13-14" "scm_init_srfi_14")
|
||||
|
||||
(define (->char-set x)
|
||||
(cond
|
||||
((string? x) (string->char-set x))
|
||||
((char? x) (char-set x))
|
||||
((char-set? x) x)
|
||||
(else (error "invalid argument to `->char-set'"))))
|
||||
|
||||
(define char-set:full (ucs-range->char-set 0 256))
|
||||
|
||||
(define char-set:lower-case (char-set-filter char-lower-case? char-set:full))
|
||||
|
||||
(define char-set:upper-case (char-set-filter char-upper-case? char-set:full))
|
||||
|
||||
(define char-set:title-case (char-set))
|
||||
|
||||
(define char-set:letter (char-set-union char-set:lower-case
|
||||
char-set:upper-case))
|
||||
|
||||
(define char-set:digit (string->char-set "0123456789"))
|
||||
|
||||
(define char-set:letter+digit
|
||||
(char-set-union char-set:letter char-set:digit))
|
||||
|
||||
(define char-set:punctuation (string->char-set "!\"#%&'()*,-./:;?@[\\]_{}"))
|
||||
|
||||
(define char-set:symbol (string->char-set "$+<=>^`|~"))
|
||||
|
||||
(define char-set:whitespace (char-set #\space #\newline #\tab #\cr #\vt #\np))
|
||||
|
||||
(define char-set:blank (char-set #\space #\tab))
|
||||
|
||||
(define char-set:graphic
|
||||
(char-set-union char-set:letter+digit char-set:punctuation char-set:symbol))
|
||||
|
||||
(define char-set:printing
|
||||
(char-set-union char-set:graphic char-set:whitespace))
|
||||
|
||||
(define char-set:iso-control
|
||||
(char-set-adjoin
|
||||
(char-set-filter (lambda (ch) (< (char->integer ch) 31)) char-set:full)
|
||||
(integer->char 127)))
|
||||
|
||||
(define char-set:hex-digit (string->char-set "0123456789abcdefABCDEF"))
|
||||
|
||||
(define char-set:ascii
|
||||
(char-set-filter (lambda (ch) (< (char->integer ch) 128)) char-set:full))
|
||||
|
||||
(define char-set:empty (char-set))
|
||||
|
||||
;;; srfi-14.scm ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue