On Tue, Sep 24, 2024 at 09:07:18PM +0800, Qian Yun wrote:
> With gcc-14 enables "-Wimplicit-function-declaration" by default,
> we get this error when building with GCL:
> 
> /tmp/fricas-1.3.11/src/lisp/fricas-lisp.c: In function
> ‘sock_get_string_buf_wrapper’:
> /tmp/fricas-1.3.11/src/lisp/fricas-lisp.c:703:10: error: implicit
> declaration of function ‘sock_get_string_buf’; did you mean
> ‘sock_send_string_len’? [-Wimplicit-function-declaration]
>   703 |   return sock_get_string_buf(i, x->st.st_self, j); }
>       |          ^~~~~~~~~~~~~~~~~~~
>       |          sock_send_string_len
> 
> 
> We need to add a declaration in the "clines".
>
> But to get the return type match, I also need to change the
> return type of "sock_get_string_buf" to int.
> Its return value is currently ignored.

Yes. Please commit.

> Writing this patch makes me realize that we need to improve
> "sock_get_string_buf" more:
> 
> First, there's discrepancy between GCL and other Lisps:
> if the string is bigger than buffer, GCL gives an error,
> while other Lisps fill the buffer with part of the string.
> But in this case the following operations with be messed up.
> Because there is no loop to clear the socket.
> 
> Currently we use a buffer of size 10000, hoping it to be big
> enough.  This should be improved later.

Yes, this is known problem.  Actually, it affects not only
'sock_get_string_buf' but also input from sockets.  One
possible solution is to have a loop at Lisp/Boot/Spad
level to get parts of input into a buffer, enlarging it
when needed.  In case of sockets we can send size first,
so two iterations would suffice.  In case of standard input
we know how big the line is only after reading it.

One more thing: we should really get rid of current uses
of 'sock_get_string_buf', instead we should get input from
a socket.  Namely, current protocol of sending control
information via socket, but data via standard input/output
if inherently problematic (can get out of sync).

-- 
                              Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/Zvgqs6xdKrM79IBh%40fricas.org.

Reply via email to