public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* Converting defs file unto guile-wrap code
@ 2001-05-29 21:14 Ariel Rios
  2001-05-29 22:05 ` Rob Browning
  0 siblings, 1 reply; 2+ messages in thread
From: Ariel Rios @ 2001-05-29 21:14 UTC (permalink / raw)
  To: guile-gtk, Rob Browning

Ok.
I plan to translate defs files unto guile-wrap by
defining macros according to the different define-foo types;

Eg for enums:
;;other functions are omitted

(define-macro (define-enum name in-mod cname val)
  `(define ,name (string-append (enum-do-let ,cname) (enum-do-values
,val) "\t#t)\n")))

ANd when evaluating for example:

guile> (define-enum DirectionType
    (in-module "Gtk")
    (c-name "GtkDirectionType")
    (values 
       '("tab-forward" "GTK_DIR_TAB_FORWARD" 0)
       '("tab-backward" "GTK_DIR_TAB_BACKWARD" 1)
       '("up" "GTK_DIR_UP" 2)
       '("down" "GTK_DIR_DOWN" 3)
       '("left" "GTK_DIR_LEFT" 4)
       '("right" "GTK_DIR_RIGHT" 5)))

guile> (display DirectionType)
(let ((we ((gw:wrap-enumeration mod '<gtk:GtkDirectionType>
	"GtkDirectionType*"
	"const GtkDirectionType*")))
	(gw:enum-add-value! we "tab-forward" 'GTK_DIR_TAB_FORWARD)
	(gw:enum-add-value! we "tab-backward" 'GTK_DIR_TAB_BACKWARD)
	(gw:enum-add-value! we "up" 'GTK_DIR_UP)
	(gw:enum-add-value! we "down" 'GTK_DIR_DOWN)
	(gw:enum-add-value! we "left" 'GTK_DIR_LEFT)
	(gw:enum-add-value! we "right" 'GTK_DIR_RIGHT)
	#t)

Now, Is these the correct approach to follow? It is obviously
a very easy way of doing it.

Any objections? 

Rob, do you think that the current defs format info is enough for
g-wrap?

ariel


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

end of thread, other threads:[~2001-05-29 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-29 21:14 Converting defs file unto guile-wrap code Ariel Rios
2001-05-29 22:05 ` Rob Browning

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).