Am 02.10.2016 um 22:57 schrieb Waldek Hebisch: > Current FriCAS connection scheme is a mess. Core of this mess is > that standard Lisp IO have no concept of socket and that original
You were completely right: it's a mess! Now, when figured out, I conceive the meaning of the "sockets" /tmp/.x (x=d,s,i,...). Since, moreover, ")lisp (setq |$SpadServer| t)" is blocking when entered in AXIOMsys, so I will abandon the idea connecting directly to the spadserver. On the other hand, connecting to a running instance seems to me quite laborious and i cant's see how it might go without add new code to sman, so it's not an option either. BTW do you know what's "Simon's algebraic viewer" was? (AV=10 below). .. include/com.h /* possible socket types (purpose) */ #define SessionManager 1 #define ViewportServer 2 #define MenuServer 3 #define SessionIO 4 #define BaloonServer 5 #define InterpWindow 6 #define KillSpad 7 #define DebugWindow 8 /* used for nagman */ #define Forker 9 #define AV 10 /*Simon's algebraic viewer */ > code performed all output to Lisp standard output using binding > of *STANDARD-OUTPUT* special variable to redirect output. In > effect all output from FriCAS to other programs appears on single > Unix file descriptor (that is standard output) and one copy of sman > is responsible to demultiplex FriCAS output and send it to proper > destination. Other programs use Unix domain sockets, and use > functions like 'connect_to_local_server' to establish connection. > Graphics only uses sockets, so is cleaner. > 'connect_to_local_server' indeed was the clue ... so in principle it'd be possible to intefere in the dispatching process by a Python program. I'm afraid, however, it would complicate things more than by now using ZMQ. ---- from ctypes import * libpath="/usr/local/lib/fricas/target/x86_64-unknown-linux/lib/libspad.so" libspad=CDLL(libpath) class SOCKADDR(Structure): _fields_ = [("sa_family",c_ushort), ("sa_data",c_char * 14)] class IN_ADDR(Structure): _fields_ = [ ("s_addr",c_ulong)] class SOCKADDR_IN(Structure): _fields_ = [("sin_family",c_short), ("sin_port", c_ushort), ("sin_addr",IN_ADDR), ("sin_zero",c_char * 8)] class ADDRESS(Union): _fields_ = [("u_addr",SOCKADDR), ("i_addr",SOCKADDR_IN)] class Sock(Structure): _fields_ = [("socket",c_int), ("type",c_int), ("purpose",c_int), ("pid",c_int), ("frame",c_int), ("remote",c_int), ("addr",ADDRESS), ("hostname",c_char_p)] spadServer="/tmp/.d" sessionManager=1 forever=0 connectls=libspad.connect_to_local_server connectls.restype=POINTER(Sock) connectls.argtypes=[c_wchar_p,c_int,c_int] #spad_server = connectls(spadServer, 1,200) spad_server = connectls("/tmp/.i12845", 4,200) s=spad_server.contents -- 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 post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.