1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 10:10:23 +02:00

Integrated the guile-srfi package into the Guile distribution.

This commit is contained in:
Martin Grabmüller 2001-04-23 20:21:01 +00:00
parent 1f7f9ed41d
commit ca003b26ce
12 changed files with 5049 additions and 0 deletions

12
srfi/.cvsignore Normal file
View file

@ -0,0 +1,12 @@
*.la
*.lo
*.x
.deps
.libs
Makefile
Makefile.in
aclocal.m4
config.log
config.status
configure
libtool

87
srfi/ChangeLog Normal file
View file

@ -0,0 +1,87 @@
2001-04-23 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
Integrated the guile-srfi package into the Guile distribution.
* srfi-13.c: All procedures so specified in the SRFI now accept
character set arguments.
* Makefile.am: Snarfed some variables from the guile-readline
directory.
* srfi-14.c, srfi-14.h: Add prefix SCM_ to exported macros.
* srfi-13.scm, srfi-14.scm, srfi-13.c, srfi-14.c, srfi-14.h,
configure.in, Makefile.am: Added FSF copyright and Guile license
information.
* srfi-13.c, srfi-14.c: Include srfi-14.h.
(scm_init_srfi_13_14): Initialize the complete module, if not
already done so.
* srfi-14.h: New file.
* srfi-13.scm, srfi-14.scm: Load new combined library.
* Makefile.am: Build only one library,
`libguile-srfi-srfi-13-14.la'
2001-04-04 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* guile-srfi.texi: Integrated the SRFI-14 documentation.
* srfi-14.c, srfi-14.scm: Made the procedures and variables
compliant to the final SRFI document.
* Renamed the package to guile-srfi.
2001-04-03 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* NEWS: New section for 0.0.3.
* configure.in, README, guile-srfi-13.texi: Bumped version number
to 0.0.3.
* Released version 0.0.2.
* Makefile.am: Added rules for builing the SRFI-14 library.
* srfi-14.c, srfi-14.scm: New files, implementing SRFI-14
(character set library).
2001-03-27 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* README: Updated procedure and incompatibility list.
* srfi-13.c (string_upcase_x, scm_string_upcase_xS),
(scm_string_upcase, string_downcase_x, scm_string_downcase_xS),
(scm_string_downcaseS, string_titlecase_x),
(scm_string_titlecase_x, scm_string_titlecase),
(scm_string_fill_xS, scm_string_copyS, scm_string_to_listS): New
procedures.
* srfi-13.scm: Export new case mapping procedures.
* guile-srfi-13.texi (What cannot be done): Removed case mapping
procedures from incompatibility list.
(Case Mapping): New section for case mapping procedures.
2001-03-26 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* NEWS: New section for 0.0.2
* configure.in, README, guile-srfi-13.texi: Bumbed version number
to 0.0.2
* Released version 0.0.1.
* README: Made procedure list up-to-date.
* guile-srfi-13.texi: Fixed typos, completed reference and added
introductory blurb.
* srfi-13.c, srfi-13.scm: Filled in the last missing pieces.
2001-03-22 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* Started guile-srfi-13 package. Files are copied from the
guile-gdbm and slightly modified.

52
srfi/Makefile.am Normal file
View file

@ -0,0 +1,52 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 59 Temple Place, Suite
## 330, Boston, MA 02111-1307 USA
AUTOMAKE_OPTIONS = foreign
#info_TEXINFOS = guile-srfi.texi
## Prevent automake from adding extra -I options
DEFS = @DEFS@
## Check for headers in $(srcdir)/.., so that #include
## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
## building.
INCLUDES = -I.. -I$(srcdir)/..
lib_LTLIBRARIES = libguile-srfi-srfi-13-14.la
BUILT_SOURCES = srfi-13.x srfi-14.x
libguile_srfi_srfi_13_14_la_SOURCES = srfi-13.x srfi-13.c srf-14.x srfi-14.c
libguile_srfi_srfi_13_14_la_LDFLAGS = -version-info 0:0 -export-dynamic
srfidir = $(datadir)/guile/$(VERSION)/srfi
srfi_DATA = srfi-13.scm srfi-14.scm
EXTRA_DIST = $(srfi_DATA)
GUILE_SNARF = ../libguile/guile-snarf
SUFFIXES = .x
.c.x:
$(GUILE_SNARF) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< > $@ \
|| { rm $@; false; }
DISTCLEANFILES = *.x

141
srfi/README Normal file
View file

@ -0,0 +1,141 @@
This is the integration of guile-srfi into the core. -*- text -*-
[ this is the README from guile-srfi 0.0.3, slightly modified for the
integration into the Guile core
'martin -- 2001-04-23 ]
This is a compiled Guile module that provides the string procedures
defined in SRFI-13 (string library), and the character set procedures
defined in SRFI-14 (character-set library).
Getting Started ======================================================
1. Type
guile
You should now be at the Guile prompt ("guile> ").
2. Type
(use-modules (srfi srfi-13))
so that the srfi-13 module gets loaded.
3. We're now ready to try some basic srfi-13/14 functionality.
$ guile
guile> (use-modules (srfi srfi-13))
guile> (string-concatenate '("Hello" " " "World"))
"Hello World"
guile>
Check out the SRFI-14 (character-set library) procedures, too:
$ guile
guile> (use-modules (srfi srfi-14))
guile> (char-set-union (char-set #\f #\o #\o) (string->char-set "bar"))
#<charset {#\a #\b #\f #\o #\r}>
guile>
What Is Included =====================================================
All SRFI-13 procedures which are not already compatibly defined in
the Guile core are implemented. These are:
string-any string-every
string-tabulate
string->list
reverse-list->string
string-join
string-copy
substring/shared string-copy!
string-take string-take-right
string-drop string-drop-right
string-pad string-pad-right
string-trim string-trim-right string-trim-both
string-fill!
string-compare string-compare-ci
string= string<>
string< string>
string<= string>=
string-ci= string-ci<>
string-ci< string-ci>
string-ci<= string-ci>=
string-hash string-hash-ci
string-prefix-length string-prefix-length-ci
string-suffix-length string-suffix-length-ci
string-prefix? string-prefix-ci?
string-suffix? string-suffix-ci?
string-index string-index-right
string-skip string-skip-right
string-count
string-contains string-contains-ci
string-upcase string-upcase!
string-downcase string-downcase!
string-titlecase string-titlecase!
string-reverse string-reverse!
string-append/shared
string-concatenate
reverse-string-concatenate
string-concatenate/shared
reverse-string-concatenate/shared
string-map string-map!
string-fold string-fold-right
string-unfold string-unfold-right
string-for-each
xsubstring string-xcopy!
string-replace string-tokenize
string-filter string-delete
All procedures and variables defined in SRFI-14 are implemented.
Thes complete list is:
char-set? char-set= char-set<=
char-set-hash
char-set-fold char-set-unfold char-set-unfold!
char-set-for-each char-set-map
char-set-copy
char-set
list->char-set list->char-set!
string->char-set string-char-set!
predicate->char-set predicate->char-set!
ucs-range->char-set ucs-range->char-set!
->char-set ->char-set!
char-set-size char-set-count
char-set-members char-set-contains?
char-set-every char-set-any
char-set-adjoin char-set-adjoin!
char-set-delete char-set-delete!
char-set-invert char-set-invert!
char-set-union char-set-union!
char-set-intersection char-set-intersection!
char-set-difference char-set-difference!
char-set-xor char-set-xor!
char-set-diff+intersection char-set-diff+intersection!
char-set:lower-case char-set:upper-case
char-set:title-case char-set:letter
char-set:digit char-set:letter+digit
char-set:graphic char-set:printing
char-set:whitespace char-set:iso-control
char-set:punctuation char-set:symbol
char-set:hex-digit char-set:blank
char-set:ascii char-set:empty
char-set:full
What Is Not Included =================================================
The following low-level procedures and syntax defined in SRFI-13
are currently not supported.
string-parse-start+end
string-parse-final-start+end
let-string-start+end
check-substring-spec
substring-spec-ok?
make-kmp-restart-vector
kmp-step
string-search-kmp

0
srfi/autogen.sh Executable file
View file

0
srfi/configure.in Normal file
View file

0
srfi/guile-srfi.texi Normal file
View file

3052
srfi/srfi-13.c Normal file

File diff suppressed because it is too large Load diff

141
srfi/srfi-13.scm Normal file
View file

@ -0,0 +1,141 @@
;;;; srfi-13.scm --- SRFI-13 procedures for Guile
;;;;
;;;; Copyright (C) 2001 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License as
;;;; published by the Free Software Foundation; either version 2, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
(define-module (srfi srfi-13))
(export
;;; Predicates
;; string? string-null? <= in the core
string-any string-every
;;; Constructors
;; make-string string <= in the core
string-tabulate
;;; List/string conversion
string->list
;; list->string <= in the core
reverse-list->string
string-join
;;; Selection
;; string-length string-ref <= in the core
string-copy
substring/shared
string-copy!
string-take string-take-right
string-drop string-drop-right
string-pad string-pad-right
string-trim string-trim-right
string-trim-both
;;; Modification
;; string-set! <= in the core
string-fill!
;;; Comparison
string-compare string-compare-ci
string= string<>
string< string>
string<= string>=
string-ci= string-ci<>
string-ci< string-ci>
string-ci<= string-ci>=
string-hash string-hash-ci ; FIXME::martin: rewrite in C?
;;; Prefixes/Suffixes
string-prefix-length
string-prefix-length-ci
string-suffix-length
string-suffix-length-ci
string-prefix?
string-prefix-ci?
string-suffix?
string-suffix-ci?
;;; Searching
string-index string-index-right
string-skip string-skip-right
string-count
string-contains string-contains-ci
;;; Alphabetic case mapping
string-upcase string-upcase!
string-downcase string-downcase!
string-titlecase string-titlecase!
;;; Reverse/Append
string-reverse string-reverse!
;; string-append <= in the core
string-append/shared
string-concatenate
reverse-string-concatenate
string-concatenate/shared
reverse-string-concatenate/shared
;;; Fold/Unfold/Map
string-map string-map!
string-fold
string-fold-right
string-unfold
string-unfold-right
string-for-each
;;; Replicate/Rotate
xsubstring string-xcopy!
;;; Miscellaneous
string-replace
string-tokenize
;;; Filtering/Deleting
string-filter
string-delete
)
(dynamic-call "scm_init_srfi_13_14" (dynamic-link "libguile-srfi-srfi-13-14"))
(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))))

1361
srfi/srfi-14.c Normal file

File diff suppressed because it is too large Load diff

61
srfi/srfi-14.h Normal file
View file

@ -0,0 +1,61 @@
#ifndef SCM_SRFI_14_H
#define SCM_SRFI_14_H
/* srfi-14.c --- SRFI-14 procedures for Guile
*
* Copyright (C) 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
* As a special exception, the Free Software Foundation gives
* permission for additional uses of the text contained in its release
* of GUILE.
*
* The exception is that, if you link the GUILE library with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public
* License. Your use of that executable is in no way restricted on
* account of linking the GUILE library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public
* License.
*
* This exception applies only to the code released by the Free
* Software Foundation under the name GUILE. If you copy code from
* other Free Software Foundation releases into a copy of GUILE, as
* the General Public License permits, the exception does not apply to
* the code that you add in this way. To avoid misleading anyone as
* to the status of such modified files, you must delete this
* exception notice from them.
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
#define SCM_CHARSET_SIZE 256
#define SCM_CHARSET_GET(cs, idx) (((long *) SCM_SMOB_DATA (cs))\
[(idx) / sizeof (long)] & (1 << ((idx) % sizeof (long))))
#define SCM_CHARSETP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_charset))
/* Smob type code for character sets. */
extern int scm_tc16_charset;
void scm_init_srfi_14 (void);
#endif /* SCM_SRFI_14_H */

142
srfi/srfi-14.scm Normal file
View file

@ -0,0 +1,142 @@
;;;; srfi-14.scm --- SRFI-14 procedures for Guile
;;;;
;;;; Copyright (C) 2001 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License as
;;;; published by the Free Software Foundation; either version 2, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
(define-module (srfi srfi-14))
(export
;;; General procedures
char-set?
char-set=
char-set<=
char-set-hash
;;; Iterating over character sets
char-set-cursor
char-set-ref
char-set-cursor-next
end-of-char-set?
char-set-fold
char-set-unfold char-set-unfold!
char-set-for-each
char-set-map
;;; Creating character sets
char-set-copy
char-set
list->char-set list->char-set!
string->char-set string-char-set!
char-set-filter char-set-filter!
ucs-range->char-set ucs-range->char-set!
->char-set
;;; Querying character sets
char-set-size
char-set-count
char-set->list
char-set->string
char-set-contains?
char-set-every
char-set-any
;;; Character set algebra
char-set-adjoin char-set-adjoin!
char-set-delete char-set-delete!
char-set-complement
char-set-union
char-set-intersection
char-set-difference
char-set-xor
char-set-diff+intersection
char-set-complement!
char-set-union!
char-set-intersection!
char-set-difference!
char-set-xor!
char-set-diff+intersection!
;;; Standard character sets
char-set:lower-case
char-set:upper-case
char-set:title-case
char-set:letter
char-set:digit
char-set:letter+digit
char-set:graphic
char-set:printing
char-set:whitespace
char-set:iso-control
char-set:punctuation
char-set:symbol
char-set:hex-digit
char-set:blank
char-set:ascii
char-set:empty
char-set:full
)
(dynamic-call "scm_init_srfi_13_14" (dynamic-link "libguile-srfi-srfi-13-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))