(in-package "PENMAN")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;COPYRIGHT (C) UNIVERSITY OF SOUTHERN CALIFORNIA, 1987, 1988, 1989             ;
;University Of Southern California, Information Sciences Institute             ;
;4676 Admiralty Way                                                            ;
;Marina Del Rey, California 90292                                              ;
;                                                                              ;
;This software was partially developed under National Science Foundation       ;
;Grant IST-8408726, Federal Contract numbers MDA903-81-C-0335,                 ;
;MDA903-87-C-0641, F49620-84-C-0100, and F49620-87-C-0005, and the             ;
;Government holds license rights under DAR 7-104.9 (a)(c)(1).  It is           ;
;transmitted outside of the University of Southern California only under       ;
;written license agreements or software exchange agreements, and its use       ;
;is limited by these agreements.  At no time shall any recipient use this      ;
;software in any manner which conflicts or interferes with the                 ;
;governmental license rights or other provisions of the governing              ;
;agreement under which it is obtained.  It is supplied "AS IS," without        ;
;any warranties of any kind.  It is furnished only on the basis that any       ;
;party who receives it indemnifies and holds harmless the parties who          ;
;furnish and originate it against any claims, demands or liabilities           ;
;connected with using it, furnishing it to others or providing it to a         ;
;third party.  THIS NOTICE MUST NOT BE REMOVED FROM THE SOFTWARE, AND IN       ;
;THE EVENT THAT THE SOFTWARE IS DIVIDED, IT SHOULD BE ATTACHED TO EVERY        ;
;PART.                                                                         ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




(defun pretty-print ( object)
  (printwindow :display-pane (pretty object)))






(defun old-get-next-word (input-string)
  "Returns the first word and the string thats left of input string, if no input left returns nil"
  (cond ((and input-string (not (equal input-string "")))
	 (let ((current-char-ptr 0 )
	       (next-char-ptr 1 )
	       (current-char (subseq input-string 0 1))
	       (first-word nil))
	   (loop
            (cond ((and first-word (equal current-char " "))
		   (return (values first-word (subseq input-string current-char-ptr))))
		  ((and (not (equal current-char " "))
			(equal next-char-ptr (length input-string)))
		   (return (values (concatenate 'string first-word current-char) nil)))
		  ((equal next-char-ptr (length input-string))
		   (return (values nil nil))))
	    (unless (equal current-char " ")
	      (setq first-word (concatenate 'string first-word current-char)))
	    (incf current-char-ptr)
	    (incf next-char-ptr )
	    (setq current-char (subseq input-string current-char-ptr next-char-ptr)))))
	(t (values nil nil))))
       


(defun justify-list-of-strings (line-length list-of-strings)
  (let ((justified-list '(" ")))
    (dolist (str list-of-strings)
      (setq justified-list (append justified-list (justify-string line-length str))))
    (cdr justified-list)))







