Skip to content
Snippets Groups Projects
Commit 0c30b890 authored by ram's avatar ram
Browse files

Fixed %SP-STRING-SEARCH to actually work, and to have some reasonable

declarations.
parent 32fba76b
Branches
Tags
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/mipsstrops.lisp,v 1.6 1991/11/09 02:47:18 wlott Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/mipsstrops.lisp,v 1.7 1992/03/14 02:18:07 ram Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -199,16 +199,21 @@ be simple strings." ...@@ -199,16 +199,21 @@ be simple strings."
(defun %sp-string-search (string1 start1 end1 string2 start2 end2) (defun %sp-string-search (string1 start1 end1 string2 start2 end2)
"%SP-String-Search String1, Start1, End1, String2, Start2, End2 "%SP-String-Search String1, Start1, End1, String2, Start2, End2
Searches for the substring of String1 specified in String2. Searches for the substring of String1 specified in String2.
Returns an index into String2 or NIL if the substring wasn't Returns an index into String2 or NIL if the substring wasn't
found." found."
(declare (simple-string string1 string2))
(do ((index2 start2 (1+ index2))) (do ((index2 start2 (1+ index2)))
((= index2 end2) nil) ((= index2 end2) nil)
(if (do ((index1 start1 (1+ index1)) (declare (fixnum index2))
(index2 index2 (1+ index2))) (when (do ((index1 start1 (1+ index1))
((= index1 end1) t) (index2 index2 (1+ index2)))
(if (char/= (char string1 index1) (char string2 index2)) ((= index1 end1) t)
(declare (fixnum index1 index2))
(when (= index2 end2)
(return-from %sp-string-search nil))
(when (char/= (char string1 index1) (char string2 index2))
(return nil))) (return nil)))
(return index2)))) (return index2))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment