Reduct
v1.0.4-3-gdaf0d70
A functional and immutable language.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
native.h
Go to the documentation of this file.
1
#ifndef REDUCT_NATIVE_H
2
#define REDUCT_NATIVE_H 1
3
4
#include "
defs.h
"
5
6
struct
reduct;
7
8
/**
9
* @file native.h
10
* @brief Native function registration.
11
* @defgroup native Native Functions
12
*
13
* A "native" is a C function that can be called at runtime.
14
*
15
* @{
16
*/
17
18
/**
19
* @brief Native function pointer type.
20
*
21
* @param reduct The Reduct structure.
22
* @param argc The number of arguments.
23
* @param argv The array of arguments.
24
* @return The result of the function.
25
*/
26
typedef
reduct_handle_t
(*
reduct_native_fn
)(
struct
reduct* reduct,
reduct_size_t
argc,
reduct_handle_t
* argv);
27
28
/**
29
* @brief Native function definition structure.
30
*/
31
typedef
struct
32
{
33
const
char
*
name
;
34
reduct_native_fn
fn
;
35
}
reduct_native_t
;
36
37
/**
38
* @brief Register native functions.
39
*
40
* @param reduct The Reduct structure.
41
* @param array An array of native function definitions.
42
* @param count The number of functions in the array.
43
*/
44
REDUCT_API
void
reduct_native_register
(
struct
reduct* reduct,
reduct_native_t
* array,
reduct_size_t
count);
45
46
/** @} */
47
48
#endif
defs.h
reduct_size_t
size_t reduct_size_t
Definition
defs.h:100
reduct_handle_t
reduct_uint64_t reduct_handle_t
Handle type.
Definition
defs.h:189
REDUCT_API
#define REDUCT_API
Definition
defs.h:7
reduct_native_fn
reduct_handle_t(* reduct_native_fn)(struct reduct *reduct, reduct_size_t argc, reduct_handle_t *argv)
Native function pointer type.
Definition
native.h:26
reduct_native_register
REDUCT_API void reduct_native_register(struct reduct *reduct, reduct_native_t *array, reduct_size_t count)
Register native functions.
reduct_native_t
Native function definition structure.
Definition
native.h:32
reduct_native_t::name
const char * name
Definition
native.h:33
reduct_native_t::fn
reduct_native_fn fn
Definition
native.h:34
reduct
native.h
Generated on Tue Apr 28 2026 14:58:52 for Reduct by
1.9.8