small fix, now use ! instead | to separate types
This commit is contained in:
parent
d2c4e32985
commit
9d49063e78
2 changed files with 17 additions and 13 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
|
const RecSep = "!" # Record separator for entries in gisup.nim, also defined in gen.nim
|
||||||
|
|
||||||
|
# caution: $$ due to string interpolation
|
||||||
let ct4nt = [
|
let ct4nt = [
|
||||||
"int32|int",
|
"int32|int",
|
||||||
"uint32|int",
|
"uint32|int",
|
||||||
"gboolean|toBool",
|
"gboolean|toBool",
|
||||||
"cstring|$"]
|
"cstring|$$"]
|
||||||
|
|
||||||
proc ct5nt(s: string): string =
|
proc ct5nt(s: string): string =
|
||||||
for i in ct4nt:
|
for i in ct4nt:
|
||||||
|
|
@ -10,10 +13,10 @@ proc ct5nt(s: string): string =
|
||||||
return i[s.len + 1 .. ^1]
|
return i[s.len + 1 .. ^1]
|
||||||
|
|
||||||
proc findSignal(name, obj: NimNode): string =
|
proc findSignal(name, obj: NimNode): string =
|
||||||
let str = ($name).replace("-", "_") & "|"
|
let str = ($name).replace("-", "_") & RecSep
|
||||||
for i in SCA:
|
for i in SCA:
|
||||||
if i.startsWith(str):
|
if i.startsWith(str):
|
||||||
let t = i.split("|", 2)[1]
|
let t = i.split(RecSep, 2)[1]
|
||||||
var n = obj
|
var n = obj
|
||||||
while true:
|
while true:
|
||||||
if n.kind != nnkBracketExpr: break
|
if n.kind != nnkBracketExpr: break
|
||||||
|
|
@ -50,7 +53,7 @@ proc $1$2 {.cdecl.} =
|
||||||
r1s.add(", cast[$5](xdata)")
|
r1s.add(", cast[$5](xdata)")
|
||||||
r1s.add(")\n")
|
r1s.add(")\n")
|
||||||
else:
|
else:
|
||||||
(sn, wid, num, ahl, all) = sci.split("|")
|
(sn, wid, num, ahl, all) = sci.split(RecSep)
|
||||||
var resl: string
|
var resl: string
|
||||||
if ahl.contains("): "):
|
if ahl.contains("): "):
|
||||||
resl = all.rsplit("): ", 1)[1]
|
resl = all.rsplit("): ", 1)[1]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# High level gobject-introspection based GTK3 bindings for the Nim programming language
|
# High level gobject-introspection based GTK3 bindings for the Nim programming language
|
||||||
# v 0.2 2017-SEP-18
|
# v 0.2 2017-SEP-19
|
||||||
# (c) S. Salewski 2017
|
# (c) S. Salewski 2017
|
||||||
|
|
||||||
# https://wiki.gnome.org/Projects/GObjectIntrospection
|
# https://wiki.gnome.org/Projects/GObjectIntrospection
|
||||||
|
|
@ -49,6 +49,7 @@ template isFunctionInfo(info: untyped): untyped =
|
||||||
(gBaseInfoGetType(cast[GIBaseInfo](info)) == GIInfoType.Function)
|
(gBaseInfoGetType(cast[GIBaseInfo](info)) == GIInfoType.Function)
|
||||||
|
|
||||||
const EM = "*"
|
const EM = "*"
|
||||||
|
const RecSep = "!" # Record separator for entries in gisup.nim, also defined in gimpl.nim
|
||||||
|
|
||||||
# hope that will work reliable
|
# hope that will work reliable
|
||||||
proc cut(s: var StringStream; pos: int) =
|
proc cut(s: var StringStream; pos: int) =
|
||||||
|
|
@ -846,16 +847,16 @@ proc writeInterface(info: GIInterfaceInfo) =
|
||||||
if gCallableInfoGetNArgs(signalInfo) > 0 or gTypeInfoGetTag(zzzu) != GITypeTag.VOID:
|
if gCallableInfoGetNArgs(signalInfo) > 0 or gTypeInfoGetTag(zzzu) != GITypeTag.VOID:
|
||||||
var memo = ""
|
var memo = ""
|
||||||
memo.add(gCallableInfoGetNArgs(signalInfo))
|
memo.add(gCallableInfoGetNArgs(signalInfo))
|
||||||
memo.add('|')
|
memo.add(RecSep)
|
||||||
var plist, arglist: string
|
var plist, arglist: string
|
||||||
var replist: TableRef[string, string]
|
var replist: TableRef[string, string]
|
||||||
(plist, arglist, replist) = genP(signalInfo, true, info)
|
(plist, arglist, replist) = genP(signalInfo, true, info)
|
||||||
memo.add(plist)
|
memo.add(plist)
|
||||||
memo.add('|')
|
memo.add(RecSep)
|
||||||
(plist, arglist, replist) = genP(signalInfo, false, info)
|
(plist, arglist, replist) = genP(signalInfo, false, info)
|
||||||
memo.add(plist)
|
memo.add(plist)
|
||||||
memo = memo.replace("\n ", "")
|
memo = memo.replace("\n ", "")
|
||||||
supmod.writeLine(" \"" & ($gBaseInfoGetName(signalInfo)).replace("-", "_") & "|" & $gBaseInfoGetName(info) & "|" & memo & "\",")
|
supmod.writeLine(" \"" & ($gBaseInfoGetName(signalInfo)).replace("-", "_") & RecSep & $gBaseInfoGetName(info) & RecSep & memo & "\",")
|
||||||
if gCallableInfoGetNArgs(signalInfo) > 0:
|
if gCallableInfoGetNArgs(signalInfo) > 0:
|
||||||
var plist, arglist: string
|
var plist, arglist: string
|
||||||
var replist: TableRef[string, string]
|
var replist: TableRef[string, string]
|
||||||
|
|
@ -1110,16 +1111,16 @@ proc writeObj(info: GIObjectInfo) =
|
||||||
if gCallableInfoGetNArgs(signalInfo) > 0 or gTypeInfoGetTag(zzzu) != GITypeTag.VOID:
|
if gCallableInfoGetNArgs(signalInfo) > 0 or gTypeInfoGetTag(zzzu) != GITypeTag.VOID:
|
||||||
var memo = ""
|
var memo = ""
|
||||||
memo.add(gCallableInfoGetNArgs(signalInfo))
|
memo.add(gCallableInfoGetNArgs(signalInfo))
|
||||||
memo.add('|')
|
memo.add(RecSep)
|
||||||
var plist, arglist: string
|
var plist, arglist: string
|
||||||
var replist: TableRef[string, string]
|
var replist: TableRef[string, string]
|
||||||
(plist, arglist, replist) = genP(signalInfo, true, info)
|
(plist, arglist, replist) = genP(signalInfo, true, info)
|
||||||
memo.add(plist)
|
memo.add(plist)
|
||||||
memo.add('|')
|
memo.add(RecSep)
|
||||||
(plist, arglist, replist) = genP(signalInfo, false, info)
|
(plist, arglist, replist) = genP(signalInfo, false, info)
|
||||||
memo.add(plist)
|
memo.add(plist)
|
||||||
memo = memo.replace("\n ", "")
|
memo = memo.replace("\n ", "")
|
||||||
supmod.writeLine(" \"" & ($gBaseInfoGetName(signalInfo)).replace("-", "_") & "|" & $gBaseInfoGetName(info) & "|" & memo & "\",")
|
supmod.writeLine(" \"" & ($gBaseInfoGetName(signalInfo)).replace("-", "_") & RecSep & $gBaseInfoGetName(info) & RecSep & memo & "\",")
|
||||||
if gCallableInfoGetNArgs(signalInfo) > 0:
|
if gCallableInfoGetNArgs(signalInfo) > 0:
|
||||||
var plist, arglist: string
|
var plist, arglist: string
|
||||||
var replist: TableRef[string, string]
|
var replist: TableRef[string, string]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue