1#pragma once
2
3#include <stdio.h>
4
5#include <pw_types.h>
6#include <pw_interfaces.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12/****************************************************************
13 * Dump functions
14 */
15
16void _pw_print_indent(FILE* fp, int indent);
17void _pw_print_type(FILE* fp, PwValuePtr value);
18void _pw_dump(FILE* fp, PwValuePtr value, int indent, _PwCompoundChain* tail);
19
20void pw_dump(FILE* fp, PwValuePtr value);
21
22[[nodiscard]] static inline bool _pw_call_dump(FILE* fp, PwValuePtr value, int indent, _PwCompoundChain* tail)
23{
24 if (tail) {
25 PwValuePtr value_seen = _pw_on_chain(value, tail);
26 if (value_seen) {
27 _pw_print_indent(fp, indent);
28 fprintf(fp, "already dumped: %p, data=%p\n", (void*) value_seen, (void*) value_seen->struct_data);
29 return true;
30 }
31 }
32 return pw_call(Basic, dump, value, fp, indent, tail);
33}
34
35#ifdef __cplusplus
36}
37#endif