Currently our socket communication protocol is messy because we have:
sman -- SessionIOServer -- use pty to capture FriCAS standard output
session -- SessionServer -- act as IO multiplex
FRICASsys -- SpadServer -- does calculation
hypertex -- MenuServer -- talks to SpadServer via SessionServer!
Theses are servers, but they also act as clients and connect to
each other.
My idea is that FRICASsys should not print to *standard-output*,
instead to a new stream *spad-output*.
With this new indirection layer, we can control where the output
goes -- it can go to standard-output (for terminal interactive
usage), or it can go through socket for hypertex clients.
(This should also solve the ')spool' problem BTW.)
This way we can eliminate SessionIOServer.
Next, I think we should eliminate SessionServer. I think we can
do IO multiplex in the SpadServer loop.
This way the communication protocol is greatly simplified.
The following patch already captures most algebra output.
We need to find the rest dozens of places that writes to
*standard-ouput*.
I think in theory this could really work!
- Qian
diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot
index 81cddac4..0bd9074c 100644
--- a/src/interp/int-top.boot
+++ b/src/interp/int-top.boot
@@ -212,6 +212,7 @@ intloopReadConsole(b, n)==
b := CONS(a, b)
ncloopEscaped a => "iterate"
n := intloopProcessStrings(nreverse b, n)
+ PRINC GET_-OUTPUT_-STREAM_-STRING _*SPAD_-OUTPUT_*
princPrompt()
b := []
diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp
index e82b4cf1..0e5d337d 100644
--- a/src/interp/vmlisp.lisp
+++ b/src/interp/vmlisp.lisp
@@ -44,6 +44,8 @@
(in-package "BOOT")
+(defvar *spad-output* (make-string-output-stream))
+
;; defuns
(defun define-function (f v)
@@ -621,7 +623,7 @@
(defun |make_append_stream| (filespec)
(CONS T (MAKE_APPENDSTREAM filespec)))
-(defun |mkOutputConsoleStream| () (CONS NIL *standard-output*))
+(defun |mkOutputConsoleStream| () (CONS NIL *spad-output*))
(defun SHUT (st) (if (streamp st) (close st) -1))
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/442d62cf-23c4-411b-8b63-c2c66b24c67a%40gmail.com.