1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +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:
Marius Vollmer 2004-08-24 22:19:21 +00:00
parent 7aa29a87f9
commit 0081b349c8
6 changed files with 72 additions and 4719 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
#ifndef SCM_SRFI_13_H #ifndef SCM_SRFI_13_H
#define 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. * 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 /* SCM_SRFI1314_API is a macro prepended to all function and data definitions
which should be exported or imported in the resulting dynamic link which should be exported or imported in the resulting dynamic link
library in the Win32 port. */ 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 (void);
SCM_SRFI1314_API void scm_init_srfi_13_14 (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); /* The following functions have new names in the core.
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); #define scm_string_to_listS scm_substring_to_list
SCM_SRFI1314_API SCM scm_reverse_list_to_string (SCM chrs); #define scm_string_copyS scm_substring_copy
SCM_SRFI1314_API SCM scm_string_join (SCM ls, SCM delimiter, SCM grammar); #define scm_substring_sharedS scm_substring_shared
SCM_SRFI1314_API SCM scm_string_copyS (SCM str, SCM start, SCM end); #define scm_string_fill_xS scm_substring_fill_x
SCM_SRFI1314_API SCM scm_substring_sharedS (SCM str, SCM start, SCM end); #define scm_string_indexS scm_string_index
SCM_SRFI1314_API SCM scm_string_copy_x (SCM target, SCM tstart, SCM s, SCM start, SCM end); #define scm_string_upcase_xS scm_substring_upcase_x
SCM_SRFI1314_API SCM scm_string_take (SCM s, SCM n); #define scm_string_upcaseS scm_substring_upcase
SCM_SRFI1314_API SCM scm_string_drop (SCM s, SCM n); #define scm_string_downcase_xS scm_substring_downcase_x
SCM_SRFI1314_API SCM scm_string_take_right (SCM s, SCM n); #define scm_string_downcaseS scm_substring_downcase
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);
#endif /* SCM_SRFI_13_H */ #endif /* SCM_SRFI_13_H */

View file

@ -19,28 +19,35 @@
;;; Commentary: ;;; Commentary:
;; This module is fully documented in the Guile Reference Manual. ;; This module is fully documented in the Guile Reference Manual.
;;
;; All procedures are in the core and are simply reexported here.
;;; Code: ;;; Code:
(define-module (srfi srfi-13) (define-module (srfi srfi-13))
:export (
(re-export
;;; Predicates ;;; Predicates
;; string? string-null? <= in the core string?
string-any string-every string-null?
string-any
string-every
;;; Constructors ;;; Constructors
;; make-string string <= in the core make-string
string
string-tabulate string-tabulate
;;; List/string conversion ;;; List/string conversion
;; string->list extended string->list
;; list->string <= in the core list->string
reverse-list->string reverse-list->string
string-join string-join
;;; Selection ;;; Selection
;; string-length string-ref <= in the core string-length
;; string-copy extended string-ref
string-copy
substring/shared substring/shared
string-copy! string-copy!
string-take string-take-right string-take string-take-right
@ -50,11 +57,12 @@
string-trim-both string-trim-both
;;; Modification ;;; Modification
;; string-set! <= in the core string-set!
;; string-fill! extended string-fill!
;;; Comparison ;;; Comparison
string-compare string-compare-ci string-compare
string-compare-ci
string= string<> string= string<>
string< string> string< string>
string<= string>= string<= string>=
@ -74,21 +82,24 @@
string-suffix-ci? string-suffix-ci?
;;; Searching ;;; Searching
;; string-index extended string-index
string-index-right string-index-right
string-skip string-skip-right string-skip string-skip-right
string-count string-count
string-contains string-contains-ci string-contains string-contains-ci
;;; Alphabetic case mapping ;;; Alphabetic case mapping
string-upcase
;; string-upcase string-upcase! extended string-upcase!
;; string-downcase string-downcase! extended string-downcase
string-titlecase string-titlecase! string-downcase!
string-titlecase
string-titlecase!
;;; Reverse/Append ;;; Reverse/Append
string-reverse string-reverse! string-reverse
;; string-append <= in the core string-reverse!
string-append
string-append/shared string-append/shared
string-concatenate string-concatenate
string-concatenate-reverse string-concatenate-reverse
@ -105,7 +116,8 @@
string-for-each-index string-for-each-index
;;; Replicate/Rotate ;;; Replicate/Rotate
xsubstring string-xcopy! xsubstring
string-xcopy!
;;; Miscellaneous ;;; Miscellaneous
string-replace string-replace
@ -113,43 +125,8 @@
;;; Filtering/Deleting ;;; Filtering/Deleting
string-filter string-filter
string-delete string-delete)
)
:replace (string->list string-copy string-fill!
string-upcase! string-upcase string-downcase! string-downcase
string-index substring/shared)
)
(cond-expand-provide (current-module) '(srfi-13)) (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 ;;; srfi-13.scm ends here

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
#define SCM_SRFI_14_H #define SCM_SRFI_14_H
/* srfi-14.c --- SRFI-14 procedures for Guile /* 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -32,71 +32,7 @@
# define SCM_SRFI1314_API extern # define SCM_SRFI1314_API extern
#endif #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_c_init_srfi_14 (void);
SCM_SRFI1314_API void scm_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 */ #endif /* SCM_SRFI_14_H */

View file

@ -1,6 +1,6 @@
;;; srfi-14.scm --- Character-set Library ;;; 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 ;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public ;; modify it under the terms of the GNU Lesser General Public
@ -22,8 +22,9 @@
;;; Code: ;;; Code:
(define-module (srfi srfi-14) (define-module (srfi srfi-14))
:export (
(re-export
;;; General procedures ;;; General procedures
char-set? char-set?
char-set= char-set=
@ -91,60 +92,8 @@
char-set:blank char-set:blank
char-set:ascii char-set:ascii
char-set:empty char-set:empty
char-set:full char-set:full)
))
(cond-expand-provide (current-module) '(srfi-14)) (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 ;;; srfi-14.scm ends here