Define argument / return types for the specified C function
331830
def prototype(self, name, argtypes, restype=None):
        """"""
        function = self.function(name)
        function.argtypes = argtypes
        if restype:
            function.restype = restype
483657
@NonNull
  public static Term function(
      @NonNull CqlIdentifier functionId, @NonNull Iterable<Term> arguments) {
    return function(null, functionId, arguments);
  }
1353698
def _make_type_comment(args_info, return_type):
    # type: (ArgTypes, InternalType) -> str
    """"""
    if not args_info.pos_args:
        args_string = ''
    else:
        args_string = ', '.join([repr(t) for t in args_info.pos_args])
    if args_info.varargs:
        varargs = '*%s' % repr(args_info.varargs)
        if args_string:
            args_string += ', %s' % varargs
        else:
            args_string = varargs
    return_name = name_from_type(return_type)
    return '(%s) -> %s' % (args_string, return_name)
225300
def p_function_declaration(self, p):
        
        if len(p) == 8:
            p[0] = self.asttypes.FuncDecl(
                identifier=p[2], parameters=None, elements=p[6])
        else:
            p[0] = self.asttypes.FuncDecl(
                identifier=p[2], parameters=p[4], elements=p[7])
        p[0].setpos(p)
914234
def _functionFabric(func_name, argList, oargList, password):
    """"""

    def functionHandler(self, *args, **kwargs):
        call_args = {}

        for (key, value) in oargList.items():
            call_args[key] = value

        for i, arg in enumerate(argList):
            if i < len(args):
                call_args[arg] = args[i]

        for (key, value) in kwargs.items():
            call_args[key] = value

        return _callFunc(self, func_name, password, call_args)

    functionHandler.__name__ = str(func_name)
    return functionHandler
983668
def c_typedefs(self):
        """"""
        defs = []
        attrs = self.opts.attrs + '\n' if self.opts.attrs else ''
        for name, args in self.funcs:
            logging.debug('name: %s args: %s', name, args)
            defs.append(
                'typedef\n{}\n{}{}({});\n'.format(
                    args[0], attrs,
                    self._c_type_name(name), make_c_args(args[2])
                )
            )
        return defs
1214004
def typechecked_func(func, force = False, argType = None, resType = None, prop_getter = False):
    
    if not pytypes.checking_enabled and not pytypes.do_logging_in_typechecked:
        return func
    assert(_check_as_func(func))
    if not force and is_no_type_check(func):
        return func
    if hasattr(func, 'do_typecheck'):
        func.do_typecheck = True
        return func
    elif hasattr(func, 'do_logging'):
        # actually shouldn't happen
        return _typeinspect_func(func, True, func.do_logging, argType, resType, prop_getter)
    else:
        return _typeinspect_func(func, True, False, argType, resType, prop_getter)
820327
def ui_func(cls, id_, name, function_type, avail_fn=always):
    """"""
    return cls(id_, name, 0, 0, function_type, FUNCTION_TYPES[function_type],
               avail_fn)
314017
def deftypes(self):
    """"""
    for f in self.body:
        if (hasattr(f, '_ctype')
                and (f._ctype._storage == Storages.TYPEDEF
                    or (f._name == '' and isinstance(f._ctype, ComposedType)))):
            yield f
1224897
def typedef(
            self,
            name=None,
            function=None,
            header_dir=None,
            header_file=None,
            recursive=None):
        """"""
        return (
            self._find_single(
                self._impl_matchers[scopedef_t.typedef],
                name=name,
                function=function,
                decl_type=self._impl_decl_types[
                    scopedef_t.typedef],
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive)
        )
861318
def typedef_handle(self, tokens):
        """"""
        if len(tokens) == 1:  # return typedef
            if self.target.startswith("3"):
                return " -> " + self.wrap_typedef(tokens[0]) + ":"
            else:
                return ":\n" + self.wrap_comment(" type: (...) -> " + tokens[0])
        else:  # argument typedef
            if len(tokens) == 3:
                varname, typedef, comma = tokens
                default = ""
            elif len(tokens) == 4:
                varname, typedef, default, comma = tokens
            else:
                raise CoconutInternalException("invalid type annotation tokens", tokens)
            if self.target.startswith("3"):
                return varname + ": " + self.wrap_typedef(typedef) + default + comma
            else:
                return varname + default + comma + self.wrap_passthrough(self.wrap_comment(" type: " + typedef) + "\n" + " " * self.tabideal)
8750
def execstr_funckw(func):
    
    import utool as ut
    funckw = ut.get_func_kwargs(func)
    return ut.execstr_dict(funckw, explicit=True)
1257029
def p_type_def_1(t):
    """"""
    # declarations is a type_info
    d = t[2]
    lineno = t.lineno(1)
    sortno = t.lineno(3) + 0.5
    if d.type == 'void':
        global error_occurred
        error_occurred = True
        print(
            u"ERROR - can't use void in typedef at line {0:d}".format(lineno))
        return
    d.lineno = lineno
    if id_unique(d.id, d.type, lineno):
        if d.type == 'enum':
            info = d.create_enum(lineno, sortno)
        elif d.type == 'struct':
            info = d.create_struct(lineno, sortno)
        elif d.type == 'union':
            info = d.create_union(lineno, sortno)
        else:
            info = d
        name_dict[d.id] = info
725024
def function_call(self, function, arguments):
        
        #push each argument to stack
        for arg in arguments:
            self.push(self.symbol(arg))
            self.free_if_register(arg)
        self.newline_text("CALL\t"+self.symtab.get_name(function), True)
        args = self.symtab.get_attribute(function)
        #generates stack cleanup if function has arguments
        if args > 0:
            args_space = self.symtab.insert_constant("{0}".format(args * 4), SharedData.TYPES.UNSIGNED)
            self.arithmetic("+", "%15", args_space, "%15")
1267565
def _ctypes_regular(parameter):
    
    if ("pointer" in parameter.modifiers or "allocatable" in parameter.modifiers
        or "target" in parameter.modifiers or parameter.dtype == "logical"):
        return (parameter.definition(local=True), False)
1182298
def arguments(function, extra_arguments=0):
    """"""
    if not hasattr(function, '__code__'):
        return ()

    return function.__code__.co_varnames[:function.__code__.co_argcount + extra_arguments]
357623
function rpc(functionName, ...datatypes) {
  const qrpc = qtypes.QInt.from(Types.RPCCALL);
  const qfunctionName = qtypes.QByteArray.from(`2${functionName}`);
  return function(target, _key, descriptor) {
    return {
      enumerable: false,
      configurable: false,
      writable: false,
      value: function(...args) {
        const data = descriptor.value.apply(this, args);
        this.qtsocket.write([
          qrpc,
          qfunctionName,
          ...data.map((value, index) => datatypes[index].from(value))
        ]);
      }
    };
  };
}