Skip to content

Commit f6f79ba

Browse files
committed
tags started to be called, but my_printf still doesn't work
1 parent 326ea67 commit f6f79ba

File tree

5 files changed

+1102
-1081
lines changed

5 files changed

+1102
-1081
lines changed

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"name": "(lldb) Launch - Macos",
3333
"type": "cppdbg",
3434
"request": "launch",
35-
"program": "${fileDirname}/value_ffi_test",
35+
"program": "${fileDirname}/c_print_args",
3636
"args": [],
3737
"stopAtEntry": false,
3838
"cwd": "${fileDirname}",

examples/c_print_args_alt/main.c

+19-16
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ double test_function3_with_args(list_t *p_list) {
2727
}
2828
METAC_GSYM_LINK(test_function3_with_args);
2929

30-
// int my_printf(const char * format, ...) {
31-
// va_list l;
32-
// va_start(l, format);
33-
// int res = vprintf(format, l);
34-
// va_end(l);
35-
// return res;
36-
// }
37-
// METAC_GSYM_LINK(my_printf);
30+
int my_printf(const char * format, ...) {
31+
va_list l;
32+
va_start(l, format);
33+
int res = vprintf(format, l);
34+
va_end(l);
35+
return res;
36+
}
37+
METAC_GSYM_LINK(my_printf);
3838

3939

4040
metac_tag_map_t * p_tagmap = NULL;
@@ -45,14 +45,14 @@ METAC_TAG_MAP_NEW(va_args_tag_map, NULL, {.mask =
4545
METAC_TAG_MAP_ENTRY_CATEGORY_MASK(METAC_TEC_final),},)
4646
/* start tags for all types */
4747

48-
// METAC_TAG_MAP_ENTRY(METAC_GSYM_LINK_ENTRY(my_printf))
49-
// METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.n = "format"}),
50-
// METAC_ZERO_ENDED_STRING()
51-
// )
52-
// METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.i = 1}),
53-
// METAC_FORMAT_BASED_VA_ARG()
54-
// )
55-
// METAC_TAG_MAP_ENTRY_END
48+
METAC_TAG_MAP_ENTRY(METAC_GSYM_LINK_ENTRY(my_printf))
49+
METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.n = "format"}),
50+
METAC_ZERO_ENDED_STRING()
51+
)
52+
METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.i = 1}),
53+
METAC_FORMAT_BASED_VA_ARG()
54+
)
55+
METAC_TAG_MAP_ENTRY_END
5656

5757
METAC_TAG_MAP_END
5858
//
@@ -65,6 +65,9 @@ int main() {
6565
list_t * p_list = (list_t[]){{.x = 42.42, .p_next = (list_t[]){{ .x = 45.4, .p_next = NULL}}}};
6666
printf("fn returned: %f\n", METAC_WRAP_FN_RES(NULL, test_function3_with_args, p_list));
6767

68+
// doesn't work yet
69+
//printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, my_printf, "%d %d", 10, 22));
70+
6871
metac_tag_map_delete(p_tagmap);
6972
return 0;
7073
}

0 commit comments

Comments
 (0)