@@ -67,6 +67,17 @@ func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := $m.CustomCall
6767 return result(int32(capi. {{ $m .CName }}(h.ptr , {{ $m .CustomCall.Args }})))
6868}
6969{{- else if $m .OutputParams }}
70+ {{- if $m .ReturnsBool }}
71+ // {{ $m .GoName }} calls the underlying NDK function.
72+ func (h *{{ $m .ReceiverType }}) {{ $m .GoName }}({{ range $i , $p := filterOutputParams (skipAndFilterOut $m .Params ) $m .OutputParams }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}) ({{ range $i , $op := $m .OutputParams }}{{ if $i }}, {{ end }}{{ $op .GoType }}{{ end }}, bool) {
73+ {{ range $op := $m .OutputParams }} var {{ $op .CParamName }}Ptr {{ $op .CapiType }}
74+ {{ end }} ok := capi. {{ $m .CName }}(h.ptr {{ range skipAndFilterOut $m .Params }}, {{ capiArg . }}{{ end }}{{ range $op := $m .OutputParams }}, &{{ $op .CParamName }}Ptr{{ end }})
75+ if !ok {
76+ return {{ range $op := $m .OutputParams }}{{ zeroValue $op }}, {{ end }}false
77+ }
78+ return {{ range $op := $m .OutputParams }}{{ if $op .IsHandle }}&{{ trimStarPrefix $op .GoType }}{ptr: {{ $op .CParamName }}Ptr}{{ else }}{{ $op .CParamName }}Ptr{{ end }}, {{ end }}true
79+ }
80+ {{- else }}
7081// {{ $m .GoName }} calls the underlying NDK function.
7182func (h *{{ $m .ReceiverType }}) {{ $m .GoName }}({{ range $i , $p := filterOutputParams (skipAndFilterOut $m .Params ) $m .OutputParams }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}) ({{ range $i , $op := $m .OutputParams }}{{ if $i }}, {{ end }}{{ $op .GoType }}{{ end }}, error) {
7283{{ range $op := $m .OutputParams }} var {{ $op .CParamName }}Ptr {{ $op .CapiType }}
@@ -76,6 +87,7 @@ func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := filterOutputP
7687 }
7788 return {{ range $op := $m .OutputParams }}{{ if $op .IsHandle }}&{{ trimStarPrefix $op .GoType }}{ptr: {{ $op .CParamName }}Ptr}{{ else }}{{ $op .CParamName }}Ptr{{ end }}, {{ end }}nil
7889}
90+ {{- end }}
7991{{- else if and $m .CallbackParam $m .ReturnsNew }}
8092// {{ $m .GoName }} creates a new {{ $m .ReturnsNew }} from this {{ $m .ReceiverType }}.
8193func (h *{{ $m .ReceiverType }}) {{ $m .GoName }}({{ range $i , $p := callbackVisibleParams $m .Params $m .CallbackParam }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}{{ if callbackVisibleParams $m .Params $m .CallbackParam }}, {{ end }}cbs {{ $m .CallbackGoType }}) (*{{ $m .ReturnsNew }}, error) {
@@ -181,6 +193,18 @@ func (h *{{ $m.ReceiverType }}) {{ $m.GoName }}({{ range $i, $p := skipAndFilter
181193{{- end }}
182194{{ range $f := .FreeFunctions }}
183195{{- if $f .OutputParams }}
196+ {{- if $f .ReturnsBool }}
197+ // {{ $f .GoName }} calls the underlying C function.
198+ func {{ $f .GoName }}({{ range $i , $p := filterOutputParams $f .Params $f .OutputParams }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}) ({{ range $i , $op := $f .OutputParams }}{{ if $i }}, {{ end }}{{ $op .GoType }}{{ end }}, bool) {
199+ {{ range $p := stringParams (filterOutputParams $f .Params $f .OutputParams ) }} {{ $p .Name }}Bytes := append([]byte({{ $p .Name }}), 0)
200+ {{ end }}{{ range $op := $f .OutputParams }} var {{ $op .CParamName }}Ptr {{ $op .CapiType }}
201+ {{ end }} ok := capi. {{ $f .CName }}({{ range $i , $p := filterOutputParams $f .Params $f .OutputParams }}{{ if $i }}, {{ end }}{{ capiArg $p }}{{ end }}{{ if filterOutputParams $f .Params $f .OutputParams }}{{ range $op := $f .OutputParams }}, &{{ $op .CParamName }}Ptr{{ end }}{{ else }}{{ range $i , $op := $f .OutputParams }}{{ if $i }}, {{ end }}&{{ $op .CParamName }}Ptr{{ end }}{{ end }})
202+ if !ok {
203+ return {{ range $op := $f .OutputParams }}{{ zeroValue $op }}, {{ end }}false
204+ }
205+ return {{ range $op := $f .OutputParams }}{{ if $op .IsHandle }}&{{ trimStarPrefix $op .GoType }}{ptr: {{ $op .CParamName }}Ptr}{{ else }}{{ $op .CParamName }}Ptr{{ end }}, {{ end }}true
206+ }
207+ {{- else }}
184208// {{ $f .GoName }} calls the underlying C function.
185209func {{ $f .GoName }}({{ range $i , $p := filterOutputParams $f .Params $f .OutputParams }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}) ({{ range $i , $op := $f .OutputParams }}{{ if $i }}, {{ end }}{{ $op .GoType }}{{ end }}, error) {
186210{{ range $p := stringParams (filterOutputParams $f .Params $f .OutputParams ) }} {{ $p .Name }}Bytes := append([]byte({{ $p .Name }}), 0)
@@ -191,6 +215,7 @@ func {{ $f.GoName }}({{ range $i, $p := filterOutputParams $f.Params $f.OutputPa
191215 }
192216 return {{ range $op := $f .OutputParams }}{{ if $op .IsHandle }}&{{ trimStarPrefix $op .GoType }}{ptr: {{ $op .CParamName }}Ptr}{{ else }}{{ $op .CParamName }}Ptr{{ end }}, {{ end }}nil
193217}
218+ {{- end }}
194219{{- else }}
195220// {{ $f .GoName }} calls the underlying C function.
196221func {{ $f .GoName }}({{ range $i , $p := $f .Params }}{{ if $i }}, {{ end }}{{ $p .Name }} {{ $p .GoType }}{{ end }}){{ if $f .Returns }} {{ $f .Returns }}{{ end }} {
0 commit comments