/[cmucl]/src/code/string.lisp
ViewVC logotype

Diff of /src/code/string.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by ram, Fri Jul 12 18:55:24 1996 UTC revision 1.8.2.2 by pw, Sat Mar 23 18:50:12 2002 UTC
# Line 9  Line 9 
9  ;;;  ;;;
10  ;;; **********************************************************************  ;;; **********************************************************************
11  ;;;  ;;;
12  ;;; Functions to implement strings for Spice Lisp  ;;; Functions to implement strings for CMU Common Lisp
13  ;;; Written by David Dill  ;;; Written by David Dill
14  ;;; Rewritten by Skef Wholey, Bill Chiles and Rob MacLachlan.  ;;; Rewritten by Skef Wholey, Bill Chiles and Rob MacLachlan.
15  ;;;  ;;;
 ;;; Runs in the standard Spice Lisp environment.  
 ;;;  
16  ;;; ****************************************************************  ;;; ****************************************************************
17  ;;;  ;;;
18  (in-package "LISP")  (in-package "LISP")
# Line 40  Line 38 
38           (let ((res (make-string 1)))           (let ((res (make-string 1)))
39             (setf (schar res 0) x) res))             (setf (schar res 0) x) res))
40          (t          (t
41           (error "~S cannot be coerced to a string." x))))           (error 'simple-type-error
42                    :datum x
43                    :expected-type '(or string symbol character)
44                    :format-control "~S cannot be coerced to a string."
45                    :format-arguments (list x)))))
46    
47  ;;; With-One-String is used to set up some string hacking things.  The keywords  ;;; With-One-String is used to set up some string hacking things.  The keywords
48  ;;; are parsed, and the string is hacked into a simple-string.  ;;; are parsed, and the string is hacked into a simple-string.
# Line 50  Line 51 
51    
52  (defmacro with-one-string (string start end cum-offset &rest forms)  (defmacro with-one-string (string start end cum-offset &rest forms)
53    `(let ((,string (if (stringp ,string) ,string (string ,string))))    `(let ((,string (if (stringp ,string) ,string (string ,string))))
54         ;; Optimizer may prove STRING is one.
55         (declare (optimize (ext:inhibit-warnings 3)))
56       (with-array-data ((,string ,string :offset-var ,cum-offset)       (with-array-data ((,string ,string :offset-var ,cum-offset)
57                         (,start ,start)                         (,start ,start)
58                         (,end (or ,end (length (the vector ,string)))))                         (,end (or ,end (length (the vector ,string)))))
# Line 355  Line 358 
358    (string-not-greaterp* string1 string2 start1 end1 start2 end2))    (string-not-greaterp* string1 string2 start1 end1 start2 end2))
359    
360    
361  (defun make-string (count &key ((:initial-element fill-char)))  (defun make-string (count &key element-type ((:initial-element fill-char)))
362    "Given a character count and an optional fill character, makes and returns    "Given a character count and an optional fill character, makes and returns
363     a new string Count long filled with the fill character."     a new string Count long filled with the fill character."
364    (declare (fixnum count))    (declare (fixnum count)
365               (ignore element-type))
366    (if fill-char    (if fill-char
367        (do ((i 0 (1+ i))        (do ((i 0 (1+ i))
368             (string (make-string count)))             (string (make-string count)))

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.2.2

  ViewVC Help
Powered by ViewVC 1.1.5