DBusProxy: Fix symbol signature generation.
[GB.DBUS] * BUG: DBusProxy: Fix symbol signature generation.
This commit is contained in:
parent
0fcacdebdf
commit
46426fc5e9
2 changed files with 37 additions and 36 deletions
|
@ -127,23 +127,23 @@ Public Sub _GetSignature(sSymbol As String, Optional bFormat As Boolean) As Stri
|
||||||
Dim I As Integer
|
Dim I As Integer
|
||||||
Dim sArg As String
|
Dim sArg As String
|
||||||
Dim sComment As String
|
Dim sComment As String
|
||||||
|
Dim hIntr As CIntrospection
|
||||||
|
|
||||||
sType = $cSignature[sSymbol]
|
sType = $cSignature[sSymbol]
|
||||||
If sType Then Goto RETURN_SIGNATURE
|
If sType Then Goto RETURN_SIGNATURE
|
||||||
|
|
||||||
iStart = $cPos[sSymbol] 'InStr($sIntrospection, " name=\"" & sSymbol & "\"", 1, gb.IgnoreCase)
|
iStart = $cPos[sSymbol] 'InStr($sIntrospection, " name=\"" & sSymbol & "\"", 1, gb.IgnoreCase)
|
||||||
If iStart = 0 Then Error.Raise("Unknown symbol")
|
If iStart = 0 Then Goto UNKNOWN_SYMBOL
|
||||||
|
|
||||||
iEnd = InStr($sIntrospection, ">", iStart)
|
hIntr = New CIntrospection(Mid$($sIntrospection, iStart))
|
||||||
If iEnd = 0 Then Error.Raise("Malformed introspection")
|
|
||||||
|
|
||||||
If Mid$($sIntrospection, iStart) Begins "<property " Then
|
If hIntr.MoveNext() Then Goto UNKNOWN_SYMBOL
|
||||||
|
|
||||||
Try sType = Scan(Mid$($sIntrospection, iStart, iEnd - iStart), "*type=\"*\"*")[1]
|
If hIntr.Node = "property" Then
|
||||||
If Error Then Error.Raise("Malformed property")
|
|
||||||
|
|
||||||
Try sAccess = Scan(Mid$($sIntrospection, iStart, iEnd - iStart), "*access=\"*\"*")[1]
|
sType = hIntr.GetAttribute("type")
|
||||||
If Error Then Error.Raise("Malformed property")
|
If Not sType Then Goto MALFORMED_SIGNATURE
|
||||||
|
sAccess = hIntr.GetAttribute("access")
|
||||||
|
|
||||||
If sAccess = "read" Then
|
If sAccess = "read" Then
|
||||||
sType &= ":r"
|
sType &= ":r"
|
||||||
|
@ -157,30 +157,25 @@ Public Sub _GetSignature(sSymbol As String, Optional bFormat As Boolean) As Stri
|
||||||
|
|
||||||
sType = "p:" & sType
|
sType = "p:" & sType
|
||||||
|
|
||||||
Else If Mid$($sIntrospection, iStart) Begins "<method " Or If Mid$($sIntrospection, iStart) Begins "<signal " Then
|
Else If hIntr.Node = "method" Or If hIntr.Node = "signal" Then
|
||||||
|
|
||||||
bSignal = Mid$($sIntrospection, iStart) Begins "<s"
|
bSignal = hIntr.Node Begins "s"
|
||||||
|
|
||||||
If Mid$($sIntrospection, iEnd - 1, 2) <> "/>" Then
|
If Not hIntr.Close Then
|
||||||
|
|
||||||
iEnd = InStr($sIntrospection, If(bSignal, "</signal>", "</method>"), iStart)
|
While Not hIntr.MoveNext()
|
||||||
|
|
||||||
Do
|
If hIntr.Node <> "arg" Then Break
|
||||||
iPos = InStr($sIntrospection, "<arg ", iPos)
|
|
||||||
If iPos = 0 Or If iPos > iEnd Then Break
|
|
||||||
iPos2 = InStr($sIntrospection, ">", iPos + 1)
|
|
||||||
If iPos2 = 0 Or If iPos2 > iEnd Then Break
|
|
||||||
|
|
||||||
sDir = "in"
|
sDir = hIntr.GetAttribute("direction")
|
||||||
Try sDir = Scan(Mid$($sIntrospection, iPos, iPos2 - iPos), "*direction=\"*\"*")[1]
|
If Not sDir Then sDir = "in"
|
||||||
|
|
||||||
Try sType = Scan(Mid$($sIntrospection, iPos, iPos2 - iPos), "*type=\"*\"*")[1]
|
sType = hIntr.GetAttribute("type")
|
||||||
If Error Then Break
|
If Not sType Then Goto MALFORMED_SIGNATURE
|
||||||
|
|
||||||
If sDir = "in" Then
|
If sDir = "in" Then
|
||||||
If bFormat Then
|
If bFormat Then
|
||||||
sName = ""
|
sName = hIntr.GetAttribute("name")
|
||||||
Try sName = Scan(Mid$($sIntrospection, iPos, iPos2 - iPos), "*name=\"*\"*")[1]
|
|
||||||
If sSignIn Then sSignIn &= "|"
|
If sSignIn Then sSignIn &= "|"
|
||||||
sSignIn &= "'" & sName & "'"
|
sSignIn &= "'" & sName & "'"
|
||||||
Endif
|
Endif
|
||||||
|
@ -192,9 +187,7 @@ Public Sub _GetSignature(sSymbol As String, Optional bFormat As Boolean) As Stri
|
||||||
sSignOut &= sType
|
sSignOut &= sType
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
iPos = iPos2
|
Wend
|
||||||
|
|
||||||
Loop
|
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
@ -202,7 +195,7 @@ Public Sub _GetSignature(sSymbol As String, Optional bFormat As Boolean) As Stri
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
||||||
Error.Raise("Unknown symbol")
|
Goto UNKNOWN_SYMBOL
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
@ -278,7 +271,7 @@ RETURN_SIGNATURE:
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
sComment = Trim(aSign[1] & " " & aSign[2])
|
sComment = Trim(aSign[1] & " -> " & aSign[2])
|
||||||
If sComment Then
|
If sComment Then
|
||||||
|
|
||||||
Do
|
Do
|
||||||
|
@ -298,6 +291,14 @@ RETURN_SIGNATURE:
|
||||||
|
|
||||||
Return sType
|
Return sType
|
||||||
|
|
||||||
|
UNKNOWN_SYMBOL:
|
||||||
|
|
||||||
|
Error.Raise("Unknown symbol")
|
||||||
|
|
||||||
|
MALFORMED_SIGNATURE:
|
||||||
|
|
||||||
|
Error.Raise("Malformed signature")
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub _Invoke(sName As String, aArg As Variant[]) As Variant
|
Public Sub _Invoke(sName As String, aArg As Variant[]) As Variant
|
||||||
|
|
|
@ -161,7 +161,7 @@ Public Sub Main()
|
||||||
|
|
||||||
'Try cManaged = DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2", "org.freedesktop.DBus.ObjectManager"].GetManagedObjects()
|
'Try cManaged = DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2", "org.freedesktop.DBus.ObjectManager"].GetManagedObjects()
|
||||||
|
|
||||||
Print DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/drives/ST1000LM024_HN_M101MBB_S2ZUJ9BCB04136", "org.freedesktop.UDisks2.Drive"]._GetSignature("SetConfiguration", True)
|
Print DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/block_devices/nvme0n1p1", "org.freedesktop.UDisks2.Filesystem"]._GetSignature("Mount", True)
|
||||||
'_GetSymbols().Join("\n")
|
'_GetSymbols().Join("\n")
|
||||||
|
|
||||||
'Print DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/drives"]._GetSymbols("node").Join("\n")
|
'Print DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/drives"]._GetSymbols("node").Join("\n")
|
||||||
|
|
Loading…
Reference in a new issue