added proc fixedgTypeInfoIsPointer()

This commit is contained in:
Stefan Salewski 2022-07-11 08:38:58 +02:00
commit 7d3dceb3df
3 changed files with 31 additions and 15 deletions

View file

@ -1,6 +1,6 @@
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim
# v 0.9.9 2022-JUL-10
# v 0.9.9 2022-JUL-11
# (c) S. Salewski 2018, 2019, 2020, 2021, 2022
# usefull for finding death code:
@ -906,6 +906,16 @@ type
proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; genArrayMark = false; tryOut2Ret: bool = false; modPrefix: bool = false): GPars
proc fixedgTypeInfoIsPointer(t: GITypeInfo): bool =
var p = gTypeInfoIsPointer(t)
if not p:
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.INTERFACE:
let iface = gTypeInfoGetInterface(t)
if gBaseInfoGetNamespace(iface) == "freetype2" and gBaseInfoGetName(iface) == "Face":
p = true # see issue https://discourse.gnome.org/t/the-gintro-nim-bindings-do-not-compile-with-latest-harfbuzz-4-4-1/10408
return p
# recursive investigate that type -- resolve Arrays and Interfaces
proc newGenRec(t: GITypeInfo; genProxy = false): RecRes =
result[1] = GenRecRes.none
@ -914,15 +924,7 @@ proc newGenRec(t: GITypeInfo; genProxy = false): RecRes =
var cAlloc = false
var newrawmark = ""
var proxyResult = false
var p = gTypeInfoIsPointer(t)
if not p:
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.INTERFACE:
let iface = gTypeInfoGetInterface(t)
if gBaseInfoGetNamespace(iface) == "freetype2" and gBaseInfoGetName(iface) == "Face":
p = true # see issue https://discourse.gnome.org/t/the-gintro-nim-bindings-do-not-compile-with-latest-harfbuzz-4-4-1/10408
var p = fixedgTypeInfoIsPointer(t)
let tag = gTypeInfoGetTag(t)
if tag == GITypeTag.GLIST:
let arrayType = gTypeInfoGetParamType(t, 0)
@ -1594,7 +1596,9 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; ge
if hhh.startsWith("gtk4", "gdk4"):
hhh.delete(3, 3)
if gTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
#if gTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
if fixedgTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
r = "ptr " & r
if r != "void":
if genProxy:
@ -4578,6 +4582,6 @@ proc gst_structure_take(oldstrPtr: var ptr Structure00; newstr: ptr Structure00)
proc take*(oldstrPtr: var Structure; newstr: Structure = nil): bool =
toBool(gst_structure_take(if oldstrPtr.isNil: nil else: cast[ptr Structure00](oldstrPtr.impl), if newstr.isNil: nil else: cast[ptr Structure00](newstr.impl)))
gtk4 CssLocation may be userAlloc !
gtk4 CssLocation may be userAlloc ! Face
]#