I'm attempting to build a pleasant FFI binding to IUP for Common Lisp.
I think I can create macros to create functions for controls that have
the IUP attribute and callback names as Lisp keyword arguments, which
would be great, because in a Lisp environment, keyword args can be
displayed and auto-completed etc. e.g. a button create would look like
this:

    (iup:button :title "Press This" :action (callback (handle)
iup:+iup-default+)

My first attempt was mostly manual, but I've since discovered I can
get a lot of metadata from IUP itself. e.g. (in pseudo C-ish)

    class = iupRegisterFindClass("button");
    table = class->attrib_func;
    for (attrib = iupTableFirst(table); attrib != NULL; attrib =
iupTableNext(table) {
        iupClassRegisterGetAttribute(class, attrib, get, set,
default_value, default, system, flag);
        ...
    }

I can use this approach to generate the Lisp bindings with IUP
class-specific attribute keyword argument lists, defaults values, and
even correctly defined callbacks using the information in the
default_value field for callback attributes (e.g. "iiiis" for
BUTTON_CB).

However, I'm concerned that I'm starting to depend on IUP internals
(e.g. with ITable's fields).

Is it unwise to build an FFI binding based on knowing about ITable to
get the attributes for a class? It doesn't seem to be documented as
part of the Internal IUP SDK which lead me to ask here.

Matt


_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to