ffi-reflect icon indicating copy to clipboard operation
ffi-reflect copied to clipboard

Possibility of implementing the `TODO: CTA_QUAL` ?

Open folays opened this issue 2 years ago • 2 comments

Hello, I'm encountering the following

ffi.cdef[[ struct ImVec4 { float x,y,z,w; }; ]]

reflect.typeof(ffi.typeof("      struct ImVec4")) -- okay
reflect.typeof(ffi.typeof("const struct ImVec4")) -- complains due to some TODO

error :

./reflect.lua:208: TODO: CTA_QUAL
stack traceback:
	[C]: in function 'error'
	./reflect.lua:208: in function 'CTA'
	./reflect.lua:281: in function 'typeof'

which is into those lines belonging to reflect.lua :

-- Logic for merging an attribute CType onto the annotated CType.
local CTAs = {[0] =
  function(a, refct) error("TODO: CTA_NONE") end,
  function(a, refct) error("TODO: CTA_QUAL") end,          <<< ERROR THERE
  function(a, refct)
    a = 2^a.value
    refct.alignment = a
    refct.attributes.align = a
  end,
  function(a, refct)
    refct.transparent = true
    refct.attributes.subtype = refct.typeid
  end,
  function(a, refct) refct.sym_name = a.name end,
  function(a, refct) error("TODO: CTA_BAD") end,
}

The "types" that I get in input are not under my control, I get those const ImVec4 from a 3rd party : https://github.com/cimgui/cimgui/blob/docking_inter/generator/output/definitions.lua

Of course I could also workaround my problem by tricking my code into stripping the const problematics to reflect.typeof()

Would you have time... to do... this TODO: CTA_QUAL ? :)

Thanks,

Kind Regards

folays avatar Feb 13 '23 02:02 folays