使用系统调用的 Common Lisp GUI 编程
谁能告诉我如何使用(Steel Bank)Common Lisp 通过系统调用编写 GUI? 我知道有一些图书馆,但这是一个语言学习练习,所以我想自己做。
我正在 Kubuntu 8.10 和 SBCL 1.0.18 上进行开发。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以仔细查看 sb-posix-package。 但正如该页面所说,“SB-UNIX 包中包含的功能仅供 SBCL 内部使用;其内容可能会因版本而异。”
另一种可能性 - 我会选择的 - 是通过 CFFI,然后执行它。
要创建窗口 GUI,您必须使用 X11,至少为您提供一个可以在其上绘画的窗口。 因此,您必须了解 X11 规范来创建窗口,并实现用于访问 Unix 域套接字的系统调用,或启动 shm 设备等。
如果您只想在控制台上显示图形,您可以考虑使用framebuffer-device <代码>/dev/fb*。 您需要 ioctl(2) 以及 read(2)ing 和 write(2)ing 的系统调用才能使用它,但我仍然认为这比使用 X11 容易得多(尽管仍然有很多工作)。 也许您应该查看 libFB 的源代码或类似的内容以了解如何初始化它等 ?
这真的是你想做的吗 这是大量的工作,你会学到很多东西,但更多的是关于linux系统基础设施,而不是SBCL,我认为。 如果您想在 SBCL 下使用 Syscalls,也许最好尝试仅使用 Linux-Syscalls 打开 TCP-Sockets - 仅此一项可能会花费数小时的时间。
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.
通过系统调用编写 GUI 是指不使用任何 GUI 工具包,例如 Gtk+ 或 Qt? 在这种情况下,您应该通过套接字直接与 X 服务器通信,并在其之上实现所有 X11 协议(或使用 CLX)和 GUI。 但这并不是一个最简单的任务,因为 X11 很复杂。
如果您决定深入了解 X11,这里有一些规范链接:http://www. xfree86.org/current/specindex.html
http://www.freedesktop.org/wiki/Specifications?action= show&redirect=标准
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