1LIBMAWK_CALL_FUNCTION(3libmawk) libmawk manual LIBMAWK_CALL_FUNCTION(3libmawk)
2
3
4
6 libmawk_call_function - call an user defined (script) function
7
9 #include <libmawk.h>
10
11 int libmawk_call_function(mawk_state_t *MAWK, const char *fname, CELL *res, const char *argtpes, ...);
12 int libmawk_call_functionp(mawk_state_t *MAWK, const char *fname, CELL
13 *res, const char *argtpes, void **args);
14
15
17 The libmawk_call_function() function looks up an user defined awk func‐
18 tion called fname , fills the stack with arguments converted from the
19 varargs and calls the function. The libmawk_call_functionp() performs
20 the same action but avoids using vararg by requiring an array of
21 generic pointers to the function arguments.
22
23 Argtype is a zero terminated string for both functions, each character
24 corresponding to an argument. Type characters are described in lib‐
25 mawk_set_cell() manual page.
26
27 If res is non-NULL, it is cell_destroyed (regardless of errors) and the
28 return value of the user function is copied into it. The caller shall
29 run libmawk_cell_destroy on it.
30
31 Argument m is a libmawk context previously returned by libmawk_initial‐
32 ize() or libmawk_initialize_stage3().
33
34
36 A pointer to the cell returned by the user function. The cell returned‐
37 must be destroyed by the application using libmawk_cell_destroy.
38
40 libmawk_initialize_stage(3libmawk), libmawk_initialize(3libmawk), lib‐
41 mawk_cell_destroy(3libmawk), libmawk_set_cell(3libmawk),
42
43
44
45libmawk 2009-08-10 LIBMAWK_CALL_FUNCTION(3libmawk)