From: Kevin M. Rosenberg Date: Mon, 28 Apr 2003 16:07:43 +0000 (+0000) Subject: r4659: *** empty log message *** X-Git-Tag: v1.96~264 X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=commitdiff_plain;h=d1e9c5969a0eecb7923dc350754ea9ab50417a1e r4659: *** empty log message *** --- diff --git a/math.lisp b/math.lisp index 9772b7a..9a6862b 100644 --- a/math.lisp +++ b/math.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Nov 2002 ;;;; -;;;; $Id: math.lisp,v 1.1 2002/11/08 06:43:34 kevin Exp $ +;;;; $Id: math.lisp,v 1.2 2003/04/28 16:07:42 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -18,7 +18,6 @@ (in-package :kmrcl) -(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) (defun deriv (f dx) #'(lambda (x) diff --git a/strings.lisp b/strings.lisp index 35a177e..9c6d4d1 100644 --- a/strings.lisp +++ b/strings.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: strings.lisp,v 1.7 2003/02/07 14:21:55 kevin Exp $ +;;;; $Id: strings.lisp,v 1.8 2003/04/28 16:07:43 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -144,18 +144,37 @@ (when (stringp str) (null (find-if #'not-whitespace? str)))) -#+ignore (defun string-replace-chars-strings (str repl-alist) "Replace all instances of a chars with a string. repl-alist is an assoc list of characters and replacement strings." + (declare (string str)) (let* ((orig-len (length str)) - (new-len orign-len)) + (new-len orig-len)) (declare (fixnum orig-len new-len)) - (dotimes (i orign-len) + (dotimes (i orig-len) (declare (fixnum i)) - (let ((c (schar i str))) - ))) - str) + (let* ((c (char str i)) + (match (assoc c repl-alist :test #'char=))) + (declare (character c)) + (when match + (incf new-len (length (cdr match)))))) + (let ((new-string (make-string new-len)) + (i 0)) + (declare (string new-string) + (fixnum i)) + (dotimes (i orig-len) + (declare (fixnum i)) + (let* ((c (char str i)) + (match (assoc c repl-alist :test #'char=))) + (declare (character c)) + (if match + (let ((subst (cdr match))) + (dotimes (j (length subst)) + (setf (char new-string i) (char subst j)) + (incf i))) + (progn + (setf (char new-string i) c))))) + new-string))) (defun escape-xml-string (string) "Escape invalid XML characters"