;;; -*- Mode: Common-Lisp; Package: User; Base: 10.; Patch-File: T -*-

;;; Reason: Fix the description fields in update-bug to truncate at spaces 
;;; and not in the middle of words.

;;;                           RESTRICTED RIGHTS LEGEND
;;;
;;; Use, duplication, or disclosure by the Government is subject to
;;; restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
;;; Technical Data and Computer Software clause at 52.227-7013.
;;;
;;;   TEXAS INSTRUMENTS INCORPORATED      
;;;   P.O. BOX 2909, M/S 2151             
;;;   AUSTIN, TEXAS 78769                 
;;;
;;; Copyright (C) 1989 Texas Instruments Incorporated.
;;; All rights reserved.

;;; Written 02/08/89 17:26:08 by SILLS,
;;; while running on URSA from band LODA
;;; With Experimental SYSTEM 6.0, Experimental VIRTUAL-MEMORY 6.0, Experimental EH 6.0,
;;;  Experimental MAKE-SYSTEM 6.0, Experimental MICRONET 6.0, Experimental LOCAL-FILE 6.0,
;;;  Experimental BASIC-PATHNAME 6.0, Experimental NETWORK-SUPPORT-COLD 6.0, Experimental BASIC-NAMESPACE 6.0,
;;;  Experimental NETWORK-NAMESPACE 6.0, Experimental DISK-IO 6.0, Experimental DISK-LABEL 6.0,
;;;  Experimental BASIC-FILE 6.0, Experimental MAC-PATHNAME 6.0, Experimental NETWORK-PATHNAME 6.0,
;;;  Experimental COMPILER 6.0, Experimental TV 6.0, Experimental DATALINK 6.0, Experimental CHAOSNET 6.0,
;;;  Experimental GC 6.0, Experimental MEMORY-AUX 6.0, Experimental NVRAM 6.0, Experimental SYSLOG 6.0,
;;;  Experimental STREAMER-TAPE 6.0, Experimental CLEH 1.0, Experimental UCL 6.0,
;;;  Experimental INPUT-EDITOR 6.0, Experimental METER 6.0, Experimental ZWEI 6.0,
;;;  Experimental DEBUG-TOOLS 6.0, Experimental NETWORK-SUPPORT 6.0, Experimental NETWORK-SERVICE 6.0,
;;;  DATALINK-DISPLAYS 6.0, Experimental FONT-EDITOR 6.0, Experimental SERIAL 6.0,
;;;  Experimental PRINTER 6.0, Experimental MAC-PRINTER-TYPES 6.0, Experimental PRINTER-TYPES 6.0,
;;;  Experimental IMAGEN 6.0, Experimental SUGGESTIONS 6.0, Experimental MAIL-DAEMON 6.0,
;;;  Experimental MAIL-READER 6.0, Experimental TELNET 6.0, Experimental VT100 6.0,
;;;  Experimental NAMESPACE-EDITOR 6.0, Experimental PROFILE 6.0, VISIDOC 6.0, Experimental BUG 10.6,
;;;  IP 3.40, Experimental TI-CLOS 14.16, Experimental CLX 3.0, Experimental X11M 1.0,
;;;  Experimental CLUE 15.0, RPC 4.19, NFS 3.4,  microcode 414, Band Name: Rel 6.0 4S 2/2

#!C
; From file UPDATE-BUG.LISP SPR$DEVICE:[SOURCE.EXPLORER] V:
#10R USER#:
(COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "USER"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* SYS:COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* SYS::*COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "BUG:BUG;UPDATE-BUG.LISP#46"


(DEFUN parse-description (function-description &optional (max-characters 320))
  "Parses the text sent into, at most, four lines of 75 characters"
  (LET ((description)
	(space-location 0)
	(old-newstring-location 0))
  (SETQ description (SUBSTITUTE #\space #\newline function-description))
  (SETQ description  (SUBSTITUTE #\space #\tab description ))
  (SETQ description  (SUBSTITUTE #\' #\" description ))
  (WHEN (> (LENGTH description) max-characters)
      (SETQ description (SUBSEQ description 0 max-characters)));;if truncates all characters over max allowed.
  (SETQ function-description ())
;the dotimes parses the fix description into, at most, 4 75 character lines.  
  (DO ((counter 0 (+ counter 1)))
      ((NULL space-location) function-description)
    (setq space-location (POSITION #\space description
				   :from-end t
				   :start old-newstring-location
				   :end (+ old-newstring-location 80)))
    (if (NULL space-location)
	(SETF function-description (cons (list (subseq description old-newstring-location))
					 function-description))
	(progn
	  (SETF function-description (cons (list (subseq description old-newstring-location space-location))
					   function-description))
	  (SETF old-newstring-location (+ space-location 1)))))

  (DOTIMES (counter (- 4 (length function-description)) function-description)
    (SETQ function-description (CONS '("") function-description));;
    );;dotimes fills empty description lines with a string instead of nil
  );;let
  );;parse-description

))
