github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/include/jit/jit-apply.h (about)

     1  /*
     2   * jit-apply.h - Dynamic invocation and closure support functions.
     3   *
     4   * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
     5   *
     6   * This file is part of the libjit library.
     7   *
     8   * The libjit library is free software: you can redistribute it and/or
     9   * modify it under the terms of the GNU Lesser General Public License
    10   * as published by the Free Software Foundation, either version 2.1 of
    11   * the License, or (at your option) any later version.
    12   *
    13   * The libjit library is distributed in the hope that it will be useful,
    14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16   * Lesser General Public License for more details.
    17   *
    18   * You should have received a copy of the GNU Lesser General Public
    19   * License along with the libjit library.  If not, see
    20   * <http://www.gnu.org/licenses/>.
    21   */
    22  
    23  #ifndef	_JIT_APPLY_H
    24  #define	_JIT_APPLY_H
    25  
    26  #include <jit/jit-type.h>
    27  
    28  #ifdef	__cplusplus
    29  extern	"C" {
    30  #endif
    31  
    32  /*
    33   * Prototype for closure functions.
    34   */
    35  typedef void (*jit_closure_func)(jit_type_t signature, void *result,
    36                                   void **args, void *user_data);
    37  
    38  /*
    39   * Opaque type for accessing vararg parameters on closures.
    40   */
    41  typedef struct jit_closure_va_list *jit_closure_va_list_t;
    42  
    43  /*
    44   * External function declarations.
    45   */
    46  void jit_apply(jit_type_t signature, void *func,
    47                 void **args, unsigned int num_fixed_args,
    48                 void *return_value);
    49  void jit_apply_raw(jit_type_t signature, void *func,
    50                     void *args, void *return_value);
    51  int jit_raw_supported(jit_type_t signature);
    52  
    53  void *jit_closure_create(jit_context_t context, jit_type_t signature,
    54  			 jit_closure_func func, void *user_data);
    55  
    56  jit_nint jit_closure_va_get_nint(jit_closure_va_list_t va);
    57  jit_nuint jit_closure_va_get_nuint(jit_closure_va_list_t va);
    58  jit_long jit_closure_va_get_long(jit_closure_va_list_t va);
    59  jit_ulong jit_closure_va_get_ulong(jit_closure_va_list_t va);
    60  jit_float32 jit_closure_va_get_float32(jit_closure_va_list_t va);
    61  jit_float64 jit_closure_va_get_float64(jit_closure_va_list_t va);
    62  jit_nfloat jit_closure_va_get_nfloat(jit_closure_va_list_t va);
    63  void *jit_closure_va_get_ptr(jit_closure_va_list_t va);
    64  void jit_closure_va_get_struct(jit_closure_va_list_t va, void *buf, jit_type_t type);
    65  
    66  #ifdef	__cplusplus
    67  };
    68  #endif
    69  
    70  #endif /* _JIT_APPLY_H */