This is the mail archive of the
guile-gtk@sources.redhat.com
mailing list for the Guile project.
Converting defs file unto guile-wrap code
- To: guile-gtk at sourceware dot cygnus dot com, Rob Browning <rlb at cs dot utexas dot edu>
- Subject: Converting defs file unto guile-wrap code
- From: Ariel Rios <ariel at linuxppc dot org>
- Date: 29 May 2001 23:17:30 -0400
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