zielmicha / nim-dbus

libdbus binding for Nim
MIT License
19 stars 7 forks source link

genbinding fails con dictionary type #21

Open bluemax75 opened 1 year ago

bluemax75 commented 1 year ago

When trying to generate the bindings for an interface with dictionary parameters:

<interface name='interfacename'>
    <method name='methodname'>
      <arg name='troubleparam' type='{ss}' direction='in'/>
    </method>
</interface>

genbinding fails with:

/home/charly/tmp/nim/dbus/genbinding.nim(21) genbinding
/home/charly/.nimble/pkgs/dbus-#HEAD/dbus/gennim.nim(75) genMethodWrapper
/home/charly/.nimble/pkgs/dbus-#HEAD/dbus/gennim.nim(40) genType
Error: unhandled exception: unsupported type [DbusException]

I was able to follow the problem to the genType procedure in gennim.nim It is missing the dtDictEntry value. I understand it should be added as the struct:

    of dtDictEntry:
      return "TableRef[" & genType(kind.keyType) & ", " & genType(kind.valueType) & "]"

At least it seems to generate a reasonable output

zielmicha commented 1 year ago

Adding support for dicts seems useful, you are welcome to try.