some tiny fixes

This commit is contained in:
Stefan Salewski 2022-10-10 10:15:41 +02:00
commit 7a4497ef6e
3 changed files with 23 additions and 8 deletions

View file

@ -29,6 +29,9 @@ with code inserted from files directly.
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by E. Bassi and other _GTK/Gnome_ developers. NOTE: This work is partly based on earlier works of J. Mansour and has been supported by E. Bassi and other _GTK/Gnome_ developers.
The `combinatorics` module was kindly provided by R. Behrends. The `combinatorics` module was kindly provided by R. Behrends.
NOTE: As we have already reached version 0.9.9, we have stopped doing releases for now. So you should do a #head install
with "nimble uninstall gintro; nimble install gintro@#head" to get an up to date version.
NOTE: This is finally version 0.9.9 of the gintro Nim GTK bindings. It contains some small fixes, that NOTE: This is finally version 0.9.9 of the gintro Nim GTK bindings. It contains some small fixes, that
we applied in the last months. Note that gintro's version numbers are unsigned integers and so wrap around, so we applied in the last months. Note that gintro's version numbers are unsigned integers and so wrap around, so
whenever there should be one more new release, that may get the tag 0.1 again. whenever there should be one more new release, that may get the tag 0.1 again.

View file

@ -217,12 +217,19 @@ proc $1$2 {.cdecl.} =
if resl == "gboolean": if resl == "gboolean":
resu.add(".ord.gboolean") resu.add(".ord.gboolean")
if resl == "int32": elif resl == "int32":
resu.add(".int32") resu.add(".int32")
if resl == "cstring": elif resl == "cstring":
resu.add(".g_strdup") resu.add(".g_strdup")
elif resl.len != 0: # result is heavy proxy object. Actually this is an ugly guess currently.
r1s.add(" let tmp = " & resu[2 .. ^1] & "\n")
r1s.add(" tmp.ignoreFinalizer = true\n")
resu = " cast[typeof(result)](tmp.impl)"
#resu.add(".impl)")
#resu = " cast[typeof(result)](" & resu
r1s.add(resu & "\n") r1s.add(resu & "\n")
all = all.replace(")", "; user_data: pointer)") all = all.replace(")", "; user_data: pointer)")
@ -238,7 +245,7 @@ proc $1$2 {.cdecl.} =
el = a & ": " & b el = a & ": " & b
all = h.join(";") all = h.join(";")
#echo all #echo all cdecl
# https://forum.nim-lang.org/t/6775#42155 # https://forum.nim-lang.org/t/6775#42155
const matcher = "Array" # is this good enough? const matcher = "Array" # is this good enough?
@ -453,4 +460,4 @@ when not declared(gtk4): # only for old gtk3, gtk4 has no gtk.Container widget.
#echo r2s #echo r2s
result = parseStmt(r1s & r2s) result = parseStmt(r1s & r2s)
# 456 lines # 463 lines

View file

@ -1,7 +1,7 @@
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language # High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim # nimpretty --maxLineLen:130 gen.nim
# v 0.9.9 2022-AUG-17 # v 0.9.9 2022-OCT-10
# (c) S. Salewski 2018, 2019, 2020, 2021, 2022 # (c) S. Salewski 2018, 2019, 2020, 2021, 2022, 2023
# usefull for finding death code: # usefull for finding death code:
# https://forum.nim-lang.org/t/5898 # https://forum.nim-lang.org/t/5898
@ -1604,6 +1604,11 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; ge
#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")): if fixedgTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")):
r = "ptr " & r r = "ptr " & r
if isSignalInfo(info) and isProxyCandidate(ret) and not genProxy and (not r.startsWith("ptr")): # for v0.9.9
r.insert("ptr ")
#echo "aaaaaaaaaaaaaaaaaaaaaa ", r
if r != "void": if r != "void":
if genProxy: if genProxy:
let h = doTypeConv(r, ngrRet) let h = doTypeConv(r, ngrRet)
@ -4583,9 +4588,9 @@ launch()
# if not xcallerAlloc.contains(el): # if not xcallerAlloc.contains(el):
# echo el # echo el
# 4559 lines gBoxedFree nice gBoxedFreeNiceCandidate template finalizerfree cstringArrayToSeq puh xxxg_param_spec_unref g_param_spec_unref generic_ # 4591 lines
# gtk_icon_view_get_tooltip_context bug Candidate ignoreFinalizer # gtk_icon_view_get_tooltip_context bug Candidate ignoreFinalizer
# gtk_tree_view_get_cursor bug getBox # gtk_tree_view_get_cursor bug getBox genRec gisup4
# #
# troubles: gTypeFundamental(gRegisteredTypeInfoGetGType(info)) == G_TYPE_BOXED: # troubles: gTypeFundamental(gRegisteredTypeInfoGetGType(info)) == G_TYPE_BOXED:
#[ #[