Skip to content

Commit

Permalink
tags started to be called, but my_printf still doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
aodinokov committed Sep 15, 2024
1 parent 326ea67 commit f6f79ba
Show file tree
Hide file tree
Showing 5 changed files with 1,102 additions and 1,081 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"name": "(lldb) Launch - Macos",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/value_ffi_test",
"program": "${fileDirname}/c_print_args",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
Expand Down
35 changes: 19 additions & 16 deletions examples/c_print_args_alt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ double test_function3_with_args(list_t *p_list) {
}
METAC_GSYM_LINK(test_function3_with_args);

// int my_printf(const char * format, ...) {
// va_list l;
// va_start(l, format);
// int res = vprintf(format, l);
// va_end(l);
// return res;
// }
// METAC_GSYM_LINK(my_printf);
int my_printf(const char * format, ...) {
va_list l;
va_start(l, format);
int res = vprintf(format, l);
va_end(l);
return res;
}
METAC_GSYM_LINK(my_printf);


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

// METAC_TAG_MAP_ENTRY(METAC_GSYM_LINK_ENTRY(my_printf))
// METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.n = "format"}),
// METAC_ZERO_ENDED_STRING()
// )
// METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.i = 1}),
// METAC_FORMAT_BASED_VA_ARG()
// )
// METAC_TAG_MAP_ENTRY_END
METAC_TAG_MAP_ENTRY(METAC_GSYM_LINK_ENTRY(my_printf))
METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.n = "format"}),
METAC_ZERO_ENDED_STRING()
)
METAC_TAG_MAP_SET_TAG(0, METAC_TEO_entry, 0, METAC_TAG_MAP_ENTRY_PARAMETER({.i = 1}),
METAC_FORMAT_BASED_VA_ARG()
)
METAC_TAG_MAP_ENTRY_END

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

// doesn't work yet
//printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, my_printf, "%d %d", 10, 22));

metac_tag_map_delete(p_tagmap);
return 0;
}
Loading

0 comments on commit f6f79ba

Please sign in to comment.