From 7a4497ef6e10622c593840e2007e133e1a2ecd3a Mon Sep 17 00:00:00 2001 From: Stefan Salewski Date: Mon, 10 Oct 2022 10:15:41 +0200 Subject: [PATCH] some tiny fixes --- README.adoc | 3 +++ gintro/gimplgobj.nim | 15 +++++++++++---- tests/gen.nim | 13 +++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.adoc b/README.adoc index 62f3d32..6bcbb7d 100644 --- a/README.adoc +++ b/README.adoc @@ -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. 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 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. diff --git a/gintro/gimplgobj.nim b/gintro/gimplgobj.nim index 88e5efd..44b6a1c 100644 --- a/gintro/gimplgobj.nim +++ b/gintro/gimplgobj.nim @@ -217,11 +217,18 @@ proc $1$2 {.cdecl.} = if resl == "gboolean": resu.add(".ord.gboolean") - if resl == "int32": + elif resl == "int32": resu.add(".int32") - if resl == "cstring": + elif resl == "cstring": 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") all = all.replace(")", "; user_data: pointer)") @@ -238,7 +245,7 @@ proc $1$2 {.cdecl.} = el = a & ": " & b all = h.join(";") - #echo all + #echo all cdecl # https://forum.nim-lang.org/t/6775#42155 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 result = parseStmt(r1s & r2s) -# 456 lines +# 463 lines diff --git a/tests/gen.nim b/tests/gen.nim index 2b23e04..5f70010 100644 --- a/tests/gen.nim +++ b/tests/gen.nim @@ -1,7 +1,7 @@ # High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language # nimpretty --maxLineLen:130 gen.nim -# v 0.9.9 2022-AUG-17 -# (c) S. Salewski 2018, 2019, 2020, 2021, 2022 +# v 0.9.9 2022-OCT-10 +# (c) S. Salewski 2018, 2019, 2020, 2021, 2022, 2023 # usefull for finding death code: # 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 fixedgTypeInfoIsPointer(ret) and callerAlloc.contains(hhh) and (not r.startsWith("ptr")): 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 genProxy: let h = doTypeConv(r, ngrRet) @@ -4583,9 +4588,9 @@ launch() # if not xcallerAlloc.contains(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_tree_view_get_cursor bug getBox +# gtk_tree_view_get_cursor bug getBox genRec gisup4 # # troubles: gTypeFundamental(gRegisteredTypeInfoGetGType(info)) == G_TYPE_BOXED: #[