In order to be able to use another f03 compiler two changes to the cfwrapper script were necessary. The boz constants were not accepted as scalar-int-constant-expr in the enumerator definition and assignment.
Instead of converting to a bit pattern the same C like bit shifting can be used:
""" Returns the Fortran bitfield from a C enum flag"""
b = int(match.group(1))
field = "1"
s = "ISHFTC(1,"+str(b)+")"
And for the hex constants simply insert the INT intrinsic function:
# Is it in hexadecimal ?
parameters = re.sub("0x([0-9A-Fa-f]+)", "INT(z'\\1')", parameters)
Now a major f03 compiler accepts the statements in gtk.f90/gtkenums-auto.f90. For example:
enum, bind(c) !GModuleFlags
enumerator :: G_MODULE_BIND_LAZY = ISHFTC(1,0)
enumerator :: G_MODULE_BIND_LOCAL = ISHFTC(1,1)
enumerator :: G_MODULE_BIND_MASK = INT(z'03')
Thank you Henk,
I will test and and apply your patch as soon as I have some time to spend on gtk-fortran.
But which "major f03 compiler" do you use ? (I could put its name on the wiki)
I have included your patches in cfwrapper.py.
Just a few random thoughts that may or may not be useful.
There are some examples of the use of g_object_get_data and g_object_set_data in the high-level list and tree routines in gtk-hl-tree.f90 which might give some feel for how the C stuff maps into Fortran.
The iso_c_binding module in gfortran 4.4.x and 4.5.x is terminally broken, in particular c_funloc does not work, therefore I would strongly advise not to use those versions for anything involving c-bindings not just gtk-fortran, the problem is solved in gfortran 4.6 and 4.7 .
It seems you were trying to use f03gl with gtk-fortran. Do you have a simple working example now? I would like to do this..