On 10/17/24 8:24 AM, Qian Yun wrote:
>
>
> On 10/16/24 11:49 PM, Waldek Hebisch wrote:
>>
>> Functions handling those streams need to be changes so that they
>> perform formatting without using Lisp stream functions. Then we
>> can redirect result to use sockets.
>>
>
> The "direct stream to socket" puzzled me.
>
> Now looks like we should use "socket-stream", which is not a part
> of CL standard, we may need to use external Lisp library like
> usocket. We will not use the sock_send/get_Int/String
> FFI C functions on the Lisp side.
To clarify things up:
1. Currently we have stuff like "(PRINC STR *standard-output*)".
2. The above propose is like "(PRINC STR *spad-output*)" where
*spad-output* is bound to a socket-stream and can be switched
at runtime.
3. The following propose uses "(SPRINC STR *spad-output*)",
where SPRINC can do ")spool", and use FFI to print to
*spad-output*, which might be a socket file descriptor.
The usocket Lisp library does not support unix domian socket,
also this higher abstraction differs from our current idiom.
I plan to use the FFI for C functions instead. (Add new
wrappers for "select", "accept", etc.)
Very preliminary tests show that this approach is workable.
Also with this redesigned architecture, it would be very
easy for SageMath to communicate with FriCAS through socket.
This method should be more stable and support more Lisps
than the call-lisp-from-c method.
- Qian