https://github.com/drewt/chicken-wayland-server
CHICKEN Scheme bindings for the libwayland server API
https://github.com/drewt/chicken-wayland-server
chicken-scheme chicken-scheme-eggs wayland
Last synced: 7 months ago
JSON representation
CHICKEN Scheme bindings for the libwayland server API
- Host: GitHub
- URL: https://github.com/drewt/chicken-wayland-server
- Owner: drewt
- License: mit
- Created: 2019-02-08T03:52:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-02T05:11:18.000Z (over 6 years ago)
- Last Synced: 2024-10-24T08:30:11.759Z (12 months ago)
- Topics: chicken-scheme, chicken-scheme-eggs, wayland
- Language: C
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
wayland-server
==============CHICKEN Scheme bindings for the libwayland server API.
Building
--------Dependencies:
* CHICKEN 5
* libwaylandRun
chicken-install
in this directory to build and install the
bindings.Usage
-----(import wayland-server)
### Naming Conventions
Procedures use the usual
kebab-case
convention. Predicates get a ?
suffix, e.g.wl-list-empty?
.Struct members are available as SRFI-17 getters/setters named
struct-name-member-name
.Enums use the convention
enum-prefix/kind
, e.g.wl-seat-capability/pointer
.### Differences from the C API
#### wl\_listener
The
make-wl-listener
function takes a procedure of one argument
and returns a *wrapped*wl\_listener
struct. The argument to this
procedure is thevoid\*
argument that would normally be passed to
a regularwl\_listener
.In C, you would put your
wl\_listener
inside of another struct
and use thewl\_container\_of
macro to access its contents from
the listener's notify function. In Scheme, you should set up a lexical
environment where your data is available, and then create a lambda to pass
tomake-wl-listener
. Or you could implement the usual callback +
user-data convention with a simple wrapper, like so:(define (*make-wl-listener proc arg)
(make-wl-listener (lambda (wl-arg) (proc arg wl-arg))))#### wl\_list
The
wl\_list\_for\_each
family of macros are available as
procedures:(wl-list-for-each list proc #!optional (convert values))
(wl-list-for-each/safe list proc #!optional (convert values))
(wl-list-for-each/reverse list proc #!optional (convert values))
(wl-list-for-each/reverse-safe list proc #!optional (convert values))The
convert
argument should be a function taking awl\_list
argument and returning some other data type. It is called
on each node and the result is passed to the procedureproc
.A function
wl-list-\>list
is provided for converting fromwl\_list
to native Scheme lists.