views:

886

answers:

2

Can anyone tell me about using (Steel Bank) Common Lisp for writing GUIs via system calls? I know there are some libraries out there but this is a language learning exercise, so I want to do it myself.

I'm developing on Kubuntu 8.10 and SBCL 1.0.18.

Thanks.

+2  A: 

By writing GUI via system calls you mean not using any GUI toolkit such as Gtk+ or Qt? In such case, you should talk directly to the X-server via socket and implement all the X11 protocol (or use CLX) and GUI on top of it. But that is not an easisest task, because X11 is complex.

In case you decide to dig into X11, there are some links for specifications: http://www.xfree86.org/current/specindex.html http://www.freedesktop.org/wiki/Specifications?action=show&redirect=Standards

dmitry_vk
+1  A: 

You can take a closer look at the sb-posix-package. But as the page sais "The functionality contained in the package SB-UNIX is for SBCL internal use only; its contents are likely to change from version to version."

Another Possibility - the one I would choose - is to include the C-syscall(2)-Instruction via CFFI, and then perform it.

To create a windowed GUI, you must use X11, at least to give you a Window to paint on. Therefore, you must know the X11-Specifications to create a window, and implement the Syscalls for accessing Unix Domain Sockets, or initiating shm-devices etc.

If you just want graphics on a console, you could think of using the framebuffer-device /dev/fb*. You need ioctl(2)'s and the syscalls for read(2)ing and write(2)ing to use it, but still, I think this would be a lot easier than using X11 for this (even though still a lot of work). Maybe you shoudld look at the sourcecode for libFB or something similar to see how to initialize it, etc.

Is this really what you want to do? This is a lot of work, you will learn a lot, but more about the linux system infrastructure, rather than about SBCL, I think. If you want to use Syscalls under SBCL, maybe its better to try to open TCP-Sockets only with Linux-Syscalls - alone this can take hours of frustration.

schoppenhauer
You paint a bleek picture, it's certainly not as easy as swing ;) Maybe looking at another system call might be a better place to start to see how Lisp does it, then move into something more graphical (if the desire is still there) afterwards. Thanks for the advice.
Douglas Brunner