guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Functions from guile-gtk


From: Daniel Skarda
Subject: Functions from guile-gtk
Date: 05 Aug 2001 01:28:26 +0000
User-agent: Gnus/5.0806 (Gnus v5.8.6) Emacs/20.6

Hello,

  before I finally leave computers (though only for one week) I would like to
submit one more idea - to merge useful functions from guile-gtk into Guile. 
Functions that are not exactly Gtk related and would be useful for other
programs based on libguile.

  What I have in mind? There is a convention in guile-gtk for "translating" C
constants (flags, masks etc) into scheme primitives:

  C:

     mylib_func (this, and, that, MYLIB_FOO_MASK | MYLIB_BAR_MASK);
     mylib_another_func (something, MYLIB_FOOBAR);

  Scheme:

     (mylib-func this and that '(foo bar))
     (mylib-another-func something 'foo)


  This translation is handled by scm.*(flags|enum).* functions in guile-gtk/
guile-gtk.c. They translate symbols (list of symbols) into numbers (or back from
numbers to scheme data). The convention is quite clean and supporting functions
could be provided by Guile (so convention could be easily adopted by other
packages). Because almost all bindings in guile-gtk are machine generated, we
should add some SCM_VALIDATE_* macros (and possibly also some snarfing macros
for easy initialisation from .x files).

  Conversion functions also handle numbers, therefore one need not to worry
about performance - you can still write:

    (define MYLIB-FOO-MASK ...)

    (mylib-func this and that (logior MYLIB-FOO-MASK MYLIB-BAR-MASK ...))

  But first approach seems to me more schemisch (possible because I got used to
it too much :)

  What do you think?

0.

ps: I am sorry because I am not able to continue discussion for one week



reply via email to

[Prev in Thread] Current Thread [Next in Thread]