From a1b2cf9cb8b3369a938ee80cc028eca8fef4d1ce Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 8 Oct 2008 02:49:53 +0000 Subject: * interp/i-util.boot (printPrompt): New. * interp/ht-util.boot (executeInterpreterCommand): Use it. * interp/int-top.boot (SpadInterpretStream): Likewise. * interp/metalex.lisp (get-a-line): Likewise. * interp/server.boot (serverReadLine): Likewise. (serverLoop): Likewise. --- src/interp/ht-util.boot | 3 +-- src/interp/i-util.boot | 6 ++++++ src/interp/int-top.boot | 8 ++++---- src/interp/metalex.lisp | 2 +- src/interp/server.boot | 11 ++++------- 5 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src/interp') diff --git a/src/interp/ht-util.boot b/src/interp/ht-util.boot index fe18f0e5..21d78e58 100644 --- a/src/interp/ht-util.boot +++ b/src/interp/ht-util.boot @@ -474,8 +474,7 @@ executeInterpreterCommand command == TERPRI() ncSetCurrentLine(command) CATCH($SpadReaderTag, parseAndInterpret command) - PRINC MKPROMPT() - FINISH_-OUTPUT() + printPrompt "andFlush" typeCheckInputAreas htPage == -- This needs to be severly beefed up diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot index 5fe07fb2..dac2c3d8 100644 --- a/src/interp/i-util.boot +++ b/src/interp/i-util.boot @@ -78,6 +78,12 @@ MKPROMPT() == '" [", SUBSTRING(CURRENTTIME(),8,NIL),'"] [", STRINGIMAGE $IOindex, '"] -> ") + +printPrompt(flush? == false) == + PRINC(MKPROMPT(), $OutputStream) + if flush? then + FORCE_-OUTPUT $OutputStream + --% Miscellaneous Zeros n == diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot index 9e5b1063..17c08196 100644 --- a/src/interp/int-top.boot +++ b/src/interp/int-top.boot @@ -134,7 +134,7 @@ SpadInterpretStream(str, source, interactive?) == $promptMsg : local := 'S2CTP023 interactive? => - PRINC(MKPROMPT()) + printPrompt() intloopReadConsole('"", str) [] intloopInclude (source,0) @@ -146,19 +146,19 @@ intloopReadConsole(b, n)== a:= serverReadLine $InputStream not STRINGP a => leaveScratchpad() #a=0 => - PRINC(MKPROMPT()) + printPrompt() intloopReadConsole('"", n) pfx := stripSpaces intloopPrefix?('")fi",a) pfx and ((pfx = '")fi") or (pfx = '")fin")) => [] b = '"" and (d := intloopPrefix?('")", a)) => setCurrentLine d c := ncloopCommand(d,n) - PRINC(MKPROMPT()) + printPrompt() intloopReadConsole('"", c) a:=CONCAT(b,a) ncloopEscaped a => intloopReadConsole(SUBSEQ(a, 0, (LENGTH a) - 1),n) c := intloopProcessString(a, n) - PRINC(MKPROMPT()) + printPrompt() intloopReadConsole('"", c) intloopPrefix?(prefix,whole) == diff --git a/src/interp/metalex.lisp b/src/interp/metalex.lisp index 65563cd7..8583158a 100644 --- a/src/interp/metalex.lisp +++ b/src/interp/metalex.lisp @@ -179,7 +179,7 @@ :adjustable t :initial-contents s)))) (defun get-a-line (stream) - (if (IS-CONSOLE stream) (princ (MKPROMPT))) + (if (IS-CONSOLE stream) (|printPrompt|)) (let ((ll (read-a-line stream))) (if (stringp ll) (make-string-adjustable ll) ll))) diff --git a/src/interp/server.boot b/src/interp/server.boot index 57a706a3..6e0ee514 100644 --- a/src/interp/server.boot +++ b/src/interp/server.boot @@ -90,8 +90,7 @@ serverReadLine(stream) == stringBuf := sockGetString $MenuServer CATCH('coerceFailure,CATCH($intTopLevel, CATCH($SpadReaderTag, parseAndInterpret stringBuf))) - PRINC MKPROMPT() - FINISH_-OUTPUT() + printPrompt "andFlush" action = $NonSmanSession => $SpadServer := nil action = $KillLispSystem => @@ -122,14 +121,13 @@ serverLoop() == IN_-STREAM: fluid := $InputStream _*EOF_*: fluid := NIL while not $EndServerSession and not _*EOF_* repeat - if $Prompt then (PRINC MKPROMPT(); FINISH_-OUTPUT()) + if $Prompt then printPrompt "andFlush" $Prompt := NIL action := serverSwitch() action = $CallInterp => CATCH('coerceFailure,CATCH($intTopLevel, CATCH($SpadReaderTag, parseAndInterpret read_-line($InputStream) ))) - PRINC MKPROMPT() - FINISH_-OUTPUT() + printPrompt "andFlush" sockSendInt($SessionManager, $EndOfOutput) action = $CreateFrame => frameName := GENSYM('"frame") @@ -155,8 +153,7 @@ serverLoop() == stringBuf := sockGetString $MenuServer CATCH('coerceFailure,CATCH($intTopLevel, CATCH($SpadReaderTag, parseAndInterpret stringBuf))) - PRINC MKPROMPT() - FINISH_-OUTPUT() + printPrompt "andFlush" sockSendInt($SessionManager, $EndOfOutput) NIL if _*EOF_* then $Prompt := true -- cgit v1.2.3