github.com/goplus/llgo@v0.8.3/py/call.go (about) 1 /* 2 * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package py 18 19 import ( 20 _ "unsafe" 21 22 "github.com/goplus/llgo/c" 23 ) 24 25 // https://docs.python.org/3/c-api/call.html 26 27 // Determine if the object o is callable. Return 1 if the object is callable and 28 // 0 otherwise. This function always succeeds. 29 // 30 // llgo:link (*Object).Callable C.PyCallable_Check 31 func (o *Object) Callable() c.Int { return 0 } 32 33 // Call a callable Python object o, with arguments given by the tuple args, and 34 // named arguments given by the dictionary kwargs. 35 // 36 // args must not be nil; use an empty tuple if no arguments are needed. If no named 37 // arguments are needed, kwargs can be nil. 38 // 39 // Return the result of the call on success, or raise an exception and return nil 40 // on failure. 41 // 42 // This is the equivalent of the Python expression: o(*args, **kwargs). 43 // 44 // llgo:link (*Object).Call C.PyObject_Call 45 func (o *Object) Call(args, kwargs *Object) *Object { return nil } 46 47 // Call a callable Python object callable without any arguments. It is the most 48 // efficient way to call a callable Python object without any argument. 49 // 50 // Return the result of the call on success, or raise an exception and return nil 51 // on failure. 52 // 53 // llgo:link (*Object).CallNoArgs C.PyObject_CallNoArgs 54 func (o *Object) CallNoArgs() *Object { return nil } 55 56 // Call a callable Python object callable with exactly 1 positional argument arg 57 // and no keyword arguments. 58 // 59 // Return the result of the call on success, or raise an exception and return nil 60 // on failure. 61 // 62 // llgo:link (*Object).CallOneArg C.PyObject_CallOneArg 63 func (o *Object) CallOneArg(arg *Object) *Object { return nil } 64 65 // Call a callable Python object o, with arguments given by the tuple args. If no 66 // arguments are needed, then args can be nil. 67 // 68 // Return the result of the call on success, or raise an exception and return nil 69 // on failure. 70 // 71 // This is the equivalent of the Python expression: o(*args). 72 // 73 // llgo:link (*Object).CallObject C.PyObject_CallObject 74 func (o *Object) CallObject(args *Object) *Object { return nil } 75 76 // Call a callable Python object o, with a variable number of C arguments. The C 77 // arguments are described using a py.BuildValue style format string. The format 78 // can be nil, indicating that no arguments are provided. 79 // 80 // Return the result of the call on success, or raise an exception and return nil 81 // on failure. 82 // 83 // This is the equivalent of the Python expression: o(*args). 84 // 85 // Note that if you only pass PyObject* args, (*Object).CallFunctionObjArgs is a 86 // faster alternative. 87 // 88 // llgo:link (*Object).CallFunction C.PyObject_CallFunction 89 func (o *Object) CallFunction(format *c.Char, __llgo_va_list ...any) *Object { return nil } 90 91 // Call a callable Python object o, with a variable number of PyObject* arguments. 92 // The arguments are provided as a variable number of parameters followed by nil. 93 // 94 // Return the result of the call on success, or raise an exception and return nil 95 // on failure. 96 // 97 // This is the equivalent of the Python expression: o(arg1, arg2, ...). 98 // 99 // llgo:link (*Object).CallFunctionObjArgs C.PyObject_CallFunctionObjArgs 100 func (o *Object) CallFunctionObjArgs(__llgo_va_list ...any) *Object { return nil } 101 102 // llgo:link (*Object).CallMethod C.PyObject_CallMethod 103 func (o *Object) CallMethod(name *c.Char, format *c.Char, __llgo_va_list ...any) *Object { 104 return nil 105 } 106 107 // llgo:link (*Object).CallMethodObjArgs C.PyObject_CallMethodObjArgs 108 func (o *Object) CallMethodObjArgs(name *Object, __llgo_va_list ...any) *Object { return nil } 109 110 // llgo:link (*Object).CallMethodNoArgs C.PyObject_CallMethodNoArgs 111 func (o *Object) CallMethodNoArgs(name *Object) *Object { return nil } 112 113 // llgo:link (*Object).CallMethodOneArg C.PyObject_CallMethodOneArg 114 func (o *Object) CallMethodOneArg(name, arg *Object) *Object { return nil } 115 116 // llgo:link (*Object).Vectorcall C.PyObject_Vectorcall 117 func (o *Object) Vectorcall(args **Object, nargs uintptr, kwnames *Object) *Object { 118 return nil 119 } 120 121 // llgo:link (*Object).VectorcallDict C.PyObject_VectorcallDict 122 func (o *Object) VectorcallDict(args **Object, nargs uintptr, kwdict *Object) *Object { 123 return nil 124 } 125 126 // llgo:link (*Object).VectorcallMethod C.PyObject_VectorcallMethod 127 func (o *Object) VectorcallMethod(name *Object, args **Object, nargs uintptr, kwnames *Object) *Object { 128 return nil 129 } 130 131 // -----------------------------------------------------------------------------