X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fmipsstrops.lisp;h=c2798d1f37c901a70660b10741120e8c7c90d7df;hb=4cf50b1896b25f5337e7c258b0b560da00d47993;hp=956a7a4c217e01daa2c54d1824f109859d9af74e;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/code/mipsstrops.lisp b/src/code/mipsstrops.lisp index 956a7a4..c2798d1 100644 --- a/src/code/mipsstrops.lisp +++ b/src/code/mipsstrops.lisp @@ -12,24 +12,16 @@ (in-package "SB!IMPL") -;(defun %sp-byte-blt (src-string src-start dst-string dst-start dst-end) -; "Moves bytes from Src-String into Dst-String between Dst-Start (inclusive) -;and Dst-End (exclusive) (Dst-Start - Dst-End bytes are moved). Overlap of the -;strings does not affect the result. This would be done on the Vax -;with MOVC3. The arguments do not need to be strings: 8-bit U-Vectors -;are also acceptable." -; (%primitive byte-blt src-string src-start dst-string dst-start dst-end)) - +;;; Compare the substrings specified by STRING1 and STRING2 and return +;;; NIL if the strings are STRING=, or the lowest index of STRING1 in +;;; which the two differ. If one string is longer than the other and +;;; the shorter is a prefix of the longer, the length of the shorter + +;;; START1 is returned. The arguments must be simple strings. +;;; +;;; This would be done on the Vax with CMPC3. (defun %sp-string-compare (string1 start1 end1 string2 start2 end2) (declare (simple-string string1 string2)) (declare (fixnum start1 end1 start2 end2)) - #!+sb-doc - "Compares the substrings specified by String1 and String2 and returns -NIL if the strings are String=, or the lowest index of String1 in -which the two differ. If one string is longer than the other and the -shorter is a prefix of the longer, the length of the shorter + start1 is -returned. This would be done on the Vax with CMPC3. The arguments must -be simple strings." (let ((len1 (- end1 start1)) (len2 (- end2 start2))) (declare (fixnum len1 len2)) @@ -56,11 +48,10 @@ be simple strings." (if (char/= (schar string1 index1) (schar string2 index2)) (return index1))))))) +;;; like %SP-STRING-COMPARE, only backwards (defun %sp-reverse-string-compare (string1 start1 end1 string2 start2 end2) (declare (simple-string string1 string2)) (declare (fixnum start1 end1 start2 end2)) - #!+sb-doc - "like %SP-STRING-COMPARE, only backwards" (let ((len1 (- end1 start1)) (len2 (- end2 start2))) (declare (fixnum len1 len2)) @@ -102,16 +93,16 @@ be simple strings." `(char-code (char-ref ,index)))) ,@body)))) +;;; The codes of the characters of STRING from START to END are used +;;; as indices into the TABLE, which is a U-Vector of 8-bit bytes. +;;; When the number picked up from the table bitwise ANDed with MASK +;;; is non-zero, the current index into the STRING is returned. +;;; +;;; (This corresponds to SCANC on the Vax.) (defun %sp-find-character-with-attribute (string start end table mask) (declare (type (simple-array (unsigned-byte 8) (256)) table) (type (or simple-string system-area-pointer) string) (fixnum start end mask)) - #!+sb-doc - "%SP-Find-Character-With-Attribute String, Start, End, Table, Mask - The codes of the characters of String from Start to End are used as indices - into the Table, which is a U-Vector of 8-bit bytes. When the number picked - up from the table bitwise ANDed with Mask is non-zero, the current - index into the String is returned. The corresponds to SCANC on the Vax." (maybe-sap-maybe-string (string) (do ((index start (1+ index))) ((>= index end) nil) @@ -119,9 +110,8 @@ be simple strings." (unless (zerop (logand (aref table (byte-ref index)) mask)) (return index))))) +;;; like %SP-FIND-CHARACTER-WITH-ATTRIBUTE, only sdrawkcaB (defun %sp-reverse-find-character-with-attribute (string start end table mask) - #!+sb-doc - "Like %SP-Find-Character-With-Attribute, only sdrawkcaB." (declare (type (or simple-string system-area-pointer) string) (fixnum start end mask) (type (array (unsigned-byte 8) (256)) table)) @@ -132,12 +122,10 @@ be simple strings." (unless (zerop (logand (aref table (byte-ref index)) mask)) (return index))))) +;;; Search STRING for the CHARACTER from START to END. If the +;;; character is found, the corresponding index into STRING is +;;; returned, otherwise NIL is returned. (defun %sp-find-character (string start end character) - #!+sb-doc - "%SP-Find-Character String, Start, End, Character - Searches String for the Character from Start to End. If the character is - found, the corresponding index into String is returned, otherwise NIL is - returned." (declare (fixnum start end) (type (or simple-string system-area-pointer) string) (base-char character)) @@ -148,15 +136,13 @@ be simple strings." (when (char= (char-ref index) character) (return index))))) +;;; Search STRING for CHARACTER from END to START. If the character is +;;; found, the corresponding index into STRING is returned, otherwise +;;; NIL is returned. (defun %sp-reverse-find-character (string start end character) (declare (type (or simple-string system-area-pointer) string) (fixnum start end) (base-char character)) - #!+sb-doc - "%SP-Reverse-Find-Character String, Start, End, Character - Searches String for Character from End to Start. If the character is - found, the corresponding index into String is returned, otherwise NIL is - returned." (maybe-sap-maybe-string (string) (do ((index (1- end) (1- index)) (terminus (1- start))) @@ -165,14 +151,13 @@ be simple strings." (if (char= (char-ref index) character) (return index))))) +;;; Return the index of the first character between START and END +;;; which is not CHAR= to CHARACTER, or NIL if there is no such +;;; character. (defun %sp-skip-character (string start end character) (declare (type (or simple-string system-area-pointer) string) (fixnum start end) (base-char character)) - #!+sb-doc - "%SP-Skip-Character String, Start, End, Character - Returns the index of the first character between Start and End which - is not Char= to Character, or NIL if there is no such character." (maybe-sap-maybe-string (string) (do ((index start (1+ index))) ((= index end) nil) @@ -180,14 +165,12 @@ be simple strings." (if (char/= (char-ref index) character) (return index))))) +;;; Return the index of the last character between START and END which +;;; is not CHAR= to CHARACTER, or NIL if there is no such character. (defun %sp-reverse-skip-character (string start end character) (declare (type (or simple-string system-area-pointer) string) (fixnum start end) (base-char character)) - #!+sb-doc - "%SP-Skip-Character String, Start, End, Character - Returns the index of the last character between Start and End which - is not Char= to Character, or NIL if there is no such character." (maybe-sap-maybe-string (string) (do ((index (1- end) (1- index)) (terminus (1- start))) @@ -196,12 +179,9 @@ be simple strings." (if (char/= (char-ref index) character) (return index))))) +;;; Search for the substring of STRING1 specified in STRING2. Return +;;; an index into STRING2, or NIL if the substring wasn't found. (defun %sp-string-search (string1 start1 end1 string2 start2 end2) - #!+sb-doc - "%SP-String-Search String1, Start1, End1, String2, Start2, End2 - Searches for the substring of String1 specified in String2. - Returns an index into String2 or NIL if the substring wasn't - found." (declare (simple-string string1 string2)) (do ((index2 start2 (1+ index2))) ((= index2 end2) nil)