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

;;; Reason: Defaulted units to :character in  :READ-CURSORPOS and  :INCREMENT-CURSORPOS.

;;;                           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 149149, M/S 2151             
;;;   AUSTIN, TEXAS 78714-9149                 
;;;
;;; Copyright (C) 1989 Texas Instruments Incorporated.
;;; All rights reserved.

;;; Written 06/29/90 14:40:22 by BERGER,
;;; while running on ARIES from band LODA
;;; With SYSTEM 6.41, VIRTUAL-MEMORY 6.3, EH 6.8, MAKE-SYSTEM 6.5, MICRONET 6.0, LOCAL-FILE 6.2,
;;;  BASIC-PATHNAME 6.5, NETWORK-SUPPORT-COLD 6.2, BASIC-NAMESPACE 6.8, NETWORK-NAMESPACE 6.1,
;;;  DISK-IO 6.4, DISK-LABEL 6.1, BASIC-FILE 6.14, MAC-PATHNAME 6.0, NETWORK-PATHNAME 6.2,
;;;  COMPILER 6.18, TV 6.32, DATALINK 6.0, Inconsistent CHAOSNET 6.9, GC 6.7, MEMORY-AUX 6.0,
;;;  NVRAM 6.4, SYSLOG 6.2, STREAMER-TAPE 6.6, UCL 6.1, INPUT-EDITOR 6.1, METER 6.2,
;;;  ZWEI 6.27, DEBUG-TOOLS 6.5, NETWORK-SUPPORT 6.1, NETWORK-SERVICE 6.3, DATALINK-DISPLAYS 6.0,
;;;  FONT-EDITOR 6.1, SERIAL 6.0, PRINTER 6.8, MAC-PRINTER-TYPES 6.2, PRINTER-TYPES 6.2,
;;;  IMAGEN 6.1, SUGGESTIONS 6.1, MAIL-DAEMON 6.6, MAIL-READER 6.9, TELNET 6.1, VT100 6.0,
;;;  NAMESPACE-EDITOR 6.7, PROFILE 6.3, VISIDOC 6.7, TI-CLOS 6.53, CLEH 6.5, IP 3.65,
;;;  Experimental BUG 11.19, Experimental CLX 7.0, Experimental CLUE 7.13, X11M 6.33,
;;;   microcode 483, Band Name: Chaos Table kludge

#!C
; From file STREAM.LISP#> BASIC-FILE; sys:
#10R SYSTEM#:
(lisp:COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "SYSTEM"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* *COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "SYS: BASIC-FILE; STREAM.#"


(DEFMETHOD (SYS:BASIC-BUFFERED-OUTPUT-STREAM :READ-CURSORPOS) (&OPTIONAL (UNITS :character))  ; DAB 06-29-90default character
  "Reads the current cursor position relative to the last NEWLINE. UNITS much be :CHARACTER.
   NOTE: The :SET-POINTER operation will reset the position of the last NEWLINE to zero. This may cause a 
   value return from  :READ-CURSORPOS to be smaller than what it really is."
    (UNLESS (EQ UNITS ':CHARACTER)
      (ERROR "UNITS is ~S; only ~S is meaningful here." UNITS ':CHARACTER))
    (IF (NULL STREAM-OUTPUT-BUFFER) ; haven't started writing yet
	(VALUES 0 0)
	(unless (or (stringp  STREAM-OUTPUT-BUFFER) (send self :characters)) ; DAB 02-22-90
	  (ERROR "~a must be a character stream." self))
	(LET ((NX (POSITION #\NEWLINE (THE STRING STREAM-OUTPUT-BUFFER)  ; DAB 12-08-89Get the last position
			    :END STREAM-OUTPUT-INDEX :FROM-END T)))
	  (VALUES (IF (NULL NX) ;Last NEWLINE is in previous buffer.
		      ;;last-position-newline is updated in :send-current-output-buffer.
		      (+ STREAM-OUTPUT-INDEX last-position-newline ) 
		      (- STREAM-OUTPUT-INDEX NX 1))
		  0))))


(DEFMETHOD (SYS:BASIC-BUFFERED-OUTPUT-STREAM :increment-CURSORPOS) (&OPTIONAL (X 0) (y 0)
								    (UNITS :character))	  ; DAB 06-29-90default character
  "Outputs X spaces from current cursor position."
    (UNLESS (EQ UNITS ':CHARACTER)
      (ERROR "UNITS is ~S; only ~S is meaningful here." UNITS ':CHARACTER))
    (unless (or (stringp  STREAM-OUTPUT-BUFFER) (send self :characters)) ; DAB 02-22-90
      (ERROR "~a must be a character stream." self))
  (UNLESS (EQ Y 0)   ; DAB 12-08-89 Y must be ZERO since we only operate in the X-plane.
    (ERROR "The Y argument must be 0"))
   (dotimes (xx x) (send self :tyo #\space))	;Output the SPACES.
   )



))
