1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

deprecate has-suffix?

* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (has-suffix?): Deprecate.

* test-suite/guile-test:
* benchmark-suite/guile-benchmark: Fix uses of deprecated has-suffix?.
This commit is contained in:
Andy Wingo 2010-06-11 01:35:41 +02:00
parent 02b582cef5
commit 010b159f56
4 changed files with 12 additions and 7 deletions

View file

@ -5,7 +5,7 @@
;;;; guile-benchmark --- run the Guile benchmark suite ;;;; guile-benchmark --- run the Guile benchmark suite
;;;; Adapted from code by Jim Blandy <jimb@red-bean.com> --- May 1999 ;;;; Adapted from code by Jim Blandy <jimb@red-bean.com> --- May 1999
;;;; ;;;;
;;;; Copyright (C) 2002, 2006 Free Software Foundation, Inc. ;;;; Copyright (C) 2002, 2006, 2010 Free Software Foundation, Inc.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program 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
@ -148,7 +148,7 @@
(let ((root-len (+ 1 (string-length benchmark-dir))) (let ((root-len (+ 1 (string-length benchmark-dir)))
(benchmarks '())) (benchmarks '()))
(for-each-file (lambda (file) (for-each-file (lambda (file)
(if (has-suffix? file ".bm") (if (string-suffix? ".bm" file)
(let ((short-name (let ((short-name
(substring file root-len))) (substring file root-len)))
(set! benchmarks (cons short-name benchmarks)))) (set! benchmarks (cons short-name benchmarks))))

View file

@ -592,6 +592,8 @@ If there is no handler at all, Guile prints an error and then exits."
;;; {Keywords} ;;; {Keywords}
;;; ;;;
;;; It's much better if you can use lambda* / define*, of course.
(define (kw-arg-ref args kw) (define (kw-arg-ref args kw)
(let ((rem (member kw args))) (let ((rem (member kw args)))
(and rem (pair? (cdr rem)) (cadr rem)))) (and rem (pair? (cdr rem)) (cadr rem))))
@ -833,9 +835,6 @@ If there is no handler at all, Guile prints an error and then exits."
(if port (begin (close-port port) #t) (if port (begin (close-port port) #t)
#f))))) #f)))))
(define (has-suffix? str suffix)
(string-suffix? suffix str))
(define (system-error-errno args) (define (system-error-errno args)
(if (eq? (car args) 'system-error) (if (eq? (car args) 'system-error)
(car (list-ref args 4)) (car (list-ref args 4))

View file

@ -42,7 +42,8 @@
error-catching-loop error-catching-loop
error-catching-repl error-catching-repl
scm-style-repl scm-style-repl
apply-to-args) apply-to-args
has-suffix?)
#:replace (module-ref-submodule module-define-submodule!)) #:replace (module-ref-submodule module-define-submodule!))
@ -395,3 +396,8 @@ better yet, use the repl from `(system repl repl)'.")
(issue-deprecation-warning (issue-deprecation-warning
"`apply-to-args' is deprecated. Include a local copy in your program.") "`apply-to-args' is deprecated. Include a local copy in your program.")
(apply fn args)) (apply fn args))
(define (has-suffix? str suffix)
(issue-deprecation-warning
"`has-suffix?' is deprecated. Use `string-suffix?' instead (args reversed).")
(string-suffix? suffix str))

View file

@ -155,7 +155,7 @@
(let ((root-len (+ 1 (string-length test-dir))) (let ((root-len (+ 1 (string-length test-dir)))
(tests '())) (tests '()))
(for-each-file (lambda (file) (for-each-file (lambda (file)
(if (has-suffix? file ".test") (if (string-suffix? ".test" file)
(let ((short-name (let ((short-name
(substring file root-len))) (substring file root-len)))
(set! tests (cons short-name tests)))) (set! tests (cons short-name tests))))