unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-xcb
@ 2013-02-17  2:00 Mark Witmer
  2013-02-17 13:12 ` guile-xcb Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Witmer @ 2013-02-17  2:00 UTC (permalink / raw)
  To: guile-user


Hi all,

I started writing my guile-xcb bidings too late to have them ready
for today, but I thought I'd describe what's coming...

guile-xcb is a language implemented in the Guile VM that parses the XML
files used by the xcb project to specify the X protocol and compiles
them into Guile modules containing all the methods and data needed to
send requests to the X server and receive replies/events back. If new X
extensions are added to the xcb library, guile-xcb can compile and add
them with no additional work.

It uses a tiny bit of C code right now, to ensure that
addition/bit-shifting/etc. operate exactly like they normally would in
plain C. I'm open to suggestions on how to do this properly in Scheme;
it would be great if this were a pure Scheme module and could go up in a
Guildhall repo.

The code is up at https://github.com/mwitmer/guile-xcb, though you'll
see that it's far from complete. But I'll keep hacking away at it!

Thanks to everyone for the awesome work being done on the Guile core and
all the exciting projects cropping up around it. I've learned a lot by
following this list and guile-devel.

--
Mark Witmer



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: guile-xcb
  2013-02-17  2:00 guile-xcb Mark Witmer
@ 2013-02-17 13:12 ` Ludovic Courtès
  2013-02-17 19:10   ` guile-xcb mark.d.witmer
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2013-02-17 13:12 UTC (permalink / raw)
  To: guile-user

Hi Mark,

Mark Witmer <mark.d.witmer@gmail.com> skribis:

> guile-xcb is a language implemented in the Guile VM that parses the XML
> files used by the xcb project to specify the X protocol and compiles
> them into Guile modules containing all the methods and data needed to
> send requests to the X server and receive replies/events back. If new X
> extensions are added to the xcb library, guile-xcb can compile and add
> them with no additional work.

Woow, looks fun!  Do you have example applications around that we could
play with?

> It uses a tiny bit of C code right now, to ensure that
> addition/bit-shifting/etc. operate exactly like they normally would in
> plain C. I'm open to suggestions on how to do this properly in Scheme;

Wouldn’t SRFI-60 or Guile’s own operations (info "(guile) Bitwise
Operations") do the job?

I see you also have wrappers for C integer subtraction and addition, but
the behavior of these upon overflow/underflow is undefined in the C
standard (see ‘-fwrapv’ in GCC.)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: guile-xcb
  2013-02-17 13:12 ` guile-xcb Ludovic Courtès
@ 2013-02-17 19:10   ` mark.d.witmer
  2013-02-17 21:26     ` guile-xcb Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: mark.d.witmer @ 2013-02-17 19:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user

ludo@gnu.org (Ludovic Courtès) writes:

>
> Woow, looks fun!  Do you have example applications around that we could
> play with?
>

Not yet. It's still a ways away from a working X application. But
hopefully in the relatively near future I'll have something
working. Once I finish the compiler part I need to write wrapper methods
to actually send data to/from the X server.

>
> Wouldn’t SRFI-60 or Guile’s own operations (info "(guile) Bitwise
> Operations") do the job?
>

With some care, I think they would. I'll have to see if XCB ever expects
<< to shift 1s off the end of an integer, since (ash n) wouldn't do
that.

And also, to be really pedantic, logcount behaves differently from XCB's
(otherwise equivalent) popcount when you give it negative numbers... but
popcount takes an unsigned integer as its argument, so nobody ought to
be using it for negative numbers anyway.

> I see you also have wrappers for C integer subtraction and addition, but
> the behavior of these upon overflow/underflow is undefined in the C
> standard (see ‘-fwrapv’ in GCC.)
>

Yeah, I'm probably being paranoid there. Time to stop worrying and learn
to love safe arithmetic functions!

-- 
Mark Witmer




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: guile-xcb
  2013-02-17 19:10   ` guile-xcb mark.d.witmer
@ 2013-02-17 21:26     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2013-02-17 21:26 UTC (permalink / raw)
  To: mark.d.witmer; +Cc: guile-user

mark.d.witmer@gmail.com skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>>
>> Woow, looks fun!  Do you have example applications around that we could
>> play with?
>>
>
> Not yet. It's still a ways away from a working X application. But
> hopefully in the relatively near future I'll have something
> working. Once I finish the compiler part I need to write wrapper methods
> to actually send data to/from the X server.

OK, we’ll wait for status updates then.  ;-)

BTW, did you consider using Scheme and macros instead of a compiler
front-end?  It may be easier to maintain in the long term.

>>
>> Wouldn’t SRFI-60 or Guile’s own operations (info "(guile) Bitwise
>> Operations") do the job?
>>
>
> With some care, I think they would. I'll have to see if XCB ever expects
> << to shift 1s off the end of an integer, since (ash n) wouldn't do
> that.
>
> And also, to be really pedantic, logcount behaves differently from XCB's
> (otherwise equivalent) popcount when you give it negative numbers... but
> popcount takes an unsigned integer as its argument, so nobody ought to
> be using it for negative numbers anyway.

I see.  Anyway, you could implement that in Scheme as well.  It’ll
certainly be slower than in C, but you could check if it’s a problem in
practice.

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-17 21:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-17  2:00 guile-xcb Mark Witmer
2013-02-17 13:12 ` guile-xcb Ludovic Courtès
2013-02-17 19:10   ` guile-xcb mark.d.witmer
2013-02-17 21:26     ` guile-xcb Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).